MantisBT - CMake
View Issue Details
0013550CMakeCMakepublic2012-09-19 13:572013-03-04 08:38
Alexander 
Brad King 
normalminoralways
closedfixed 
x86-64LinuxopenSUSE 12.1
CMake 2.8.9 
CMake 2.8.10CMake 2.8.10 
0013550: CMAKE_C_COMPILE_OPTIONS_PIE not set for Clang
I'm trying to use CMAKE_C_COMPILE_OPTIONS_PIE and CMAKE_CXX_COMPILE_OPTIONS_PIE variables, but they are not set when using Clang.

I found this in /usr/share/cmake/Modules/Compiler/GNU.cmake :

  if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 3.4)
    set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE")
  endif()

Clang is a GNU-compatible compiler (I have version 3.1), but it doesn't pass the check.

Thanks
No tags attached.
Issue History
2012-09-19 13:57AlexanderNew Issue
2012-09-19 14:04Brad KingAssigned To => Brad King
2012-09-19 14:04Brad KingStatusnew => assigned
2012-09-19 14:19Brad KingNote Added: 0031065
2012-09-19 14:19Brad KingStatusassigned => resolved
2012-09-19 14:19Brad KingResolutionopen => fixed
2012-09-19 14:19Brad KingFixed in Version => CMake 2.8.10
2012-09-19 14:19Brad KingTarget Version => CMake 2.8.10
2013-03-04 08:38Robert MaynardNote Added: 0032453
2013-03-04 08:38Robert MaynardStatusresolved => closed

Notes
(0031065)
Brad King   
2012-09-19 14:19   
Good catch. I factored out Clang compiler info files to have their own code path:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6e34aea9 [^]

Then I used it to add the PIE setting:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ada9efd3 [^]

Thanks!
(0032453)
Robert Maynard   
2013-03-04 08:38   
Closing resolved issues that have not been updated in more than 4 months.