[cmake-developers] Adding logic to CMake for -fPIE and -fPIC
Stephen Kelly
steveire at gmail.com
Sat May 5 15:07:25 EDT 2012
Brad King wrote:
> On 5/3/2012 12:02 PM, Stephen Kelly wrote:
>> * Make set(CMAKE_POSITION_INDEPENDENT_BINARIES True) set the appropriate
>> flags.
>
> This is the right choice IMO, though the variable should just
> initialize a "POSITION_INDEPENDENT" target property. The target
> property would then map to the right flag. You'll need to factor
> out and generalize the CMAKE_SHARED_LIBRARY_${lang}_FLAGS platform
> information variable:
>
>
http://cmake.org/gitweb?p=cmake.git;a=blob;f=Modules/Compiler/GNU.cmake;hb=v2.8.8#l24
>
> currently used to add -fPIC to compilation of objects in shared
> libraries. Make its use based on the new property, and simply
> make the property true by default for shared libraries.
>
> -Brad
Ok. Then factoring out how it is set is the first step. Looking at the
output of 'git grep -i " \?pic\b"' and 'git grep -wi +Z', there are many
different ways of telling the compiler that we want this property. Most of
them are ancient unix which I can't test. Should I change those at all?
Thanks,
Steve.
More information about the cmake-developers
mailing list