Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use target_link_options to pass linker options #108

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#

# CMake version
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)

#
# Configure CMake environment
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The main target platforms are typical desktop, laptop, and server platforms. Cur
However, other UNIX versions may work as well if they are supported by CMake.

The cmake-init template assumes you want to setup a project using
* CMake (3.0 or above)
* CMake (3.13 or above)
* C/C++ compiler


Expand Down Expand Up @@ -99,7 +99,7 @@ As with most CMake projects, cmake-init initializes the CMake environment. This

```cmake
# CMake version
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
```

required policies,
Expand Down Expand Up @@ -155,12 +155,12 @@ if (WriterCompilerDetectionHeaderFound)
endif ()
```

Another issue with older CMake versions is the unavailability of then-unpublished language standards (e.g., C++11 and CMake 3.0). For those versions, the compile options has to be extended manually.
Another issue with older CMake versions is the unavailability of then-unpublished language standards (e.g., C++11 and CMake 3.13). For those versions, the compile options has to be extended manually.

For new projects, we suggest to require at least CMake 3.2 and to therefore adjust the minimum required version:

```cmake
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
```


Expand Down
12 changes: 6 additions & 6 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ branches:
- master
clone_folder: c:\projects\cmake-init
image:
- Visual Studio 2013
- Visual Studio 2015
- Visual Studio 2017
- Visual Studio 2019
configuration:
- Release
- Debug
Expand All @@ -22,20 +22,20 @@ matrix:
# skip unsupported combinations
init:
- set arch=
- if "%arch%"=="Win64" ( set arch= Win64)
- if "%arch%"=="Win64" ( set arch= x64)
- echo %arch%
- echo %APPVEYOR_BUILD_WORKER_IMAGE%
- if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2017" ( set generator="Visual Studio 15 2017%arch%" )
- if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" ( set generator="Visual Studio 14 2015%arch%" )
- if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2013" ( set generator="Visual Studio 12 2013%arch%" )
- if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2017" ( set generator="Visual Studio 15 2017" )
- if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" ( set generator="Visual Studio 14 2015" )
- if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2019" ( set generator="Visual Studio 16 2019" )
- echo %generator%

before_build:
- cmd: |-
mkdir build
cd build
cmake --version
cmake .. -G %generator%
cmake .. -G %generator% -A %arch%

build:
project: c:\projects\cmake-init\build\template.sln
Expand Down
2 changes: 1 addition & 1 deletion source/baselib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ target_compile_options(${target}
# Linker options
#

target_link_libraries(${target}
target_link_options(${target}
PRIVATE

PUBLIC
Expand Down
2 changes: 1 addition & 1 deletion source/examples/fibcmd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ target_compile_options(${target}
# Linker options
#

target_link_libraries(${target}
target_link_options(${target}
PRIVATE
${DEFAULT_LINKER_OPTIONS}
)
Expand Down
2 changes: 1 addition & 1 deletion source/examples/fibgui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ target_compile_options(${target}
# Linker options
#

target_link_libraries(${target}
target_link_options(${target}
PRIVATE
${DEFAULT_LINKER_OPTIONS}
)
Expand Down
2 changes: 1 addition & 1 deletion source/fiblib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ target_compile_options(${target}
# Linker options
#

target_link_libraries(${target}
target_link_options(${target}
PRIVATE

PUBLIC
Expand Down
2 changes: 1 addition & 1 deletion source/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#

# CMake version
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)

# Meta information about the project
set(META_PROJECT_NAME "template")
Expand Down
2 changes: 1 addition & 1 deletion source/tests/fiblib-test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ target_compile_options(${target}
# Linker options
#

target_link_libraries(${target}
target_link_options(${target}
PRIVATE
${DEFAULT_LINKER_OPTIONS}
)