[cmake-developers] Adding logic to CMake for -fPIE and -fPIC
Stephen Kelly
steveire at gmail.com
Tue Jun 5 13:49:16 EDT 2012
Brad King wrote:
> On 06/05/2012 01:23 PM, Stephen Kelly wrote:
>> Brad King wrote:
>>> You can't try_compile inside a platform file.
>>
>> I'm not sure I'm trying to?
>
> I thought you meant you would add the try_compile to the platform file
> to decide whether to report -fPIE.
>
>> Do you mean in the tests, or do you mean the POSITION_INDEPENDENT_CODE
>> feature should be disabled for older GCC?
>
> I mean that
>
> set(CMAKE_${lang}_COMPILE_OPTIONS_PIE "-fPIE")
>
> should not be done if the compiler does not have -fPIE.
> Therefore Modules/Compiler/GNU.cmake needs to test the
> compiler version to decide whether -fPIE is available.
I see. Done for GNU.cmake now at least.
> Likely other toolchains will need similar checks.
We'll have to deal with those as they come I guess.
Thanks,
Steve.
More information about the cmake-developers
mailing list