MantisBT - CMake
View Issue Details
0015934CMakeCMakepublic2016-01-26 02:582016-06-10 14:31
Guy Harris 
Kitware Robot 
normalminorN/A
closedmoved 
allallall
CMake 2.8.12.2 
 
0015934: There's no way to test whether a given *linker* flag works
There are macros to test whether a given *compiler* flag works, such as CHECK_C_COMPILER_FLAG and CHECK_CXX_COMPILER_FLAG.

There is no macro to test whether a given *linker* flag works.

Furthermore, there does not appear to be a way to do a CHECK_C_SOURCE_RUNS with a given *linker* flag, so there does not appear to be a way to *write* a macro to test whether a given linker flag works. Setting CMAKE_REQUIRED_FLAGS does *not* affect what flags are used with, for example, the Xcode generator; it works with the Unix makefile generator, but that's not sufficient to support multiple build systems.
No tags attached.
related to 0014066closed Brad King Provided CMAKE_*_LINKER_FLAGS ignored during configuration step 
Issue History
2016-01-26 02:58Guy HarrisNew Issue
2016-01-26 10:02Brad KingRelationship addedrelated to 0014066
2016-01-26 10:09Brad KingNote Added: 0040327
2016-06-10 14:29Kitware RobotNote Added: 0042921
2016-06-10 14:29Kitware RobotStatusnew => resolved
2016-06-10 14:29Kitware RobotResolutionopen => moved
2016-06-10 14:29Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0040327)
Brad King   
2016-01-26 10:09   
There are some ways to get linker flags through try_compile.

Since CMake 2.8.11 the try_compile command supports a LINK_LIBRARIES option that is implemented by calling target_link_libraries in the generated project. This may be able to pass linker flags too. Since CMake 3.2 the try_run command supports the option too.

Since CMake 3.2 the CMAKE_EXE_LINKER_FLAGS will be passed. See 0014066:0037379 and policy CMP0056:

 https://cmake.org/cmake/help/v3.4/policy/CMP0056.html [^]

Still, there is no first-class option giving link flags to try_compile.
(0042921)
Kitware Robot   
2016-06-10 14:29   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.