MantisBT - CMake
View Issue Details
0015264CMakeCMakepublic2014-11-25 04:222015-04-06 09:07
Evgeniy Stepanov 
 
normalmajoralways
closedduplicate 
x86_64Linux
CMake 3.0.2 
 
0015264: check_cxx_compiler_flag fails to use linker flags
check_cxx_compiler_flag test compilation AND linking of a test source file, but it fails to use linker flags when doing so.

In certain configurations, custom compiler flags used by the project require custom linker flags. For example, if I've got libc++ in a non-standard location, I would use CMAKE_CXX_FLAGS=-stdlib=libc++ CMAKE_EXE_LINKER_FLAGS=-L/path/to/libc++ CMAKE_MODULE_LINKER_FLAGS=-L/path/to/libc++ CMAKE_SHARED_LINKER_FLAGS=-L/path/to/libc++.

In this situation, check_cxx_compiler_flag uses compiler flags, but not linker flags, which fails linking if there is no system-wide installation of libc++.

See also: http://llvm.org/bugs/show_bug.cgi?id=19071 [^]

Note that there is a similar problem with the compiler test ("Check for working CXX compiler"). It uses CMAKE_CXX_FLAGS and env['LDFLAGS']. It does not use any of CMAKE_*_LINKER_FLAGS or env['CXXFLAGS']. It does not make any sense to me. Let me know if I should file it as a separate issue.
No tags attached.
duplicate of 0014066closed Brad King Provided CMAKE_*_LINKER_FLAGS ignored during configuration step 
Issue History
2014-11-25 04:22Evgeniy StepanovNew Issue
2014-11-25 09:46Brad KingRelationship addedduplicate of 0014066
2014-11-25 09:51Brad KingNote Added: 0037280
2014-11-25 09:51Brad KingStatusnew => resolved
2014-11-25 09:51Brad KingResolutionopen => duplicate
2015-04-06 09:07Robert MaynardNote Added: 0038447
2015-04-06 09:07Robert MaynardStatusresolved => closed

Notes
(0037280)
Brad King   
2014-11-25 09:51   
Resolving as duplicate of 0014066. See 0014066:0037279.
(0038447)
Robert Maynard   
2015-04-06 09:07   
Closing resolved issues that have not been updated in more than 4 months.