[cmake-developers] [CMake 0015235]: CMAKE_LD_FLAGS from toolchain is ignored by compiler's check

Mantis Bug Tracker mantis at public.kitware.com
Thu Nov 6 11:57:43 EST 2014


The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=15235 
====================================================================== 
Reported By:                Andrew Aladjev
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   15235
Category:                   CMake
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2014-11-06 11:57 EST
Last Modified:              2014-11-06 11:57 EST
====================================================================== 
Summary:                    CMAKE_LD_FLAGS from toolchain is ignored by
compiler's check
Description: 
I want to use gcc's thread sanitizer. I have toolchain.cmake

set (CMAKE_SYSTEM_NAME "Linux")
set (CMAKE_C_COMPILER "gcc-4.8.3")
set (CMAKE_C_FLAGS "-fPIE -Werror -Wno-maybe-uninitialized -fsanitize=thread
-fno-omit-frame-pointer" CACHE STRING "gcc-4.8.3 thread cflags")
set (CMAKE_LD_FLAGS "-pie")

Steps to Reproduce: 
cmake -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake ..

/usr/bin/gcc-4.8.3 -fPIE -Werror -Wno-maybe-uninitialized -fsanitize=thread
-fno-omit-frame-pointer
CMakeFiles/cmTryCompileExec3265698553.dir/testCCompiler.c.o -o
cmTryCompileExec3265698553 -rdynamic

gcc-4.8.3: error: -fsanitize=thread linking must be done with -pie or -shared

CMAKE_C_FLAGS works, but CMAKE_LD_FLAGS is ignored.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2014-11-06 11:57 Andrew Aladjev New Issue                                    
======================================================================



More information about the cmake-developers mailing list