[cmake-developers] [CMake 0015264]: check_cxx_compiler_flag fails to use linker flags

Mantis Bug Tracker mantis at public.kitware.com
Tue Nov 25 04:22:08 EST 2014


The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=15264 
====================================================================== 
Reported By:                Evgeniy Stepanov
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   15264
Category:                   CMake
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2014-11-25 04:22 EST
Last Modified:              2014-11-25 04:22 EST
====================================================================== 
Summary:                    check_cxx_compiler_flag fails to use linker flags
Description: 
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.

====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2014-11-25 04:22 Evgeniy StepanovNew Issue                                    
======================================================================



More information about the cmake-developers mailing list