[cmake-developers] Adding logic to CMake for -fPIE and -fPIC
Stephen Kelly
steveire at gmail.com
Wed Jun 6 03:48:48 EDT 2012
Stephen Kelly wrote:
> 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.
>
This seems to have caused todays failures:
http://open.cdash.org/buildSummary.php?buildid=2337242
That build has CMAKE_C_COMPILER_VERSION == 4.6.1:
http://open.cdash.org/testDetails.php?test=148901720&build=2337242
but it seems that -fPIE is not added:
http://open.cdash.org/testDetails.php?test=148901721&build=2337242
It doesn't make sense for me to attempt to debug that because I don't have
access to the box.
Can someone who has access to one of the boces that is failing like that
debug it please?
Things to check are:
* Does the test fail when you run it
* Does the test pass when you remove the change to GNU.cmake
* Does the test pass if you replace
if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4)
with
if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 3.4)
(I've just patched the code to use that anyway, but please try both to
confirm if that is the reason for the failure without waiting for tomorrow)
* Does the try_compile source dir correctly contain
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
* Does the CMAKE_CXX_COMPILE_OPTIONS_PIE contain "-fPIE" when checked in the
unit test?
Thanks,
Steve.
More information about the cmake-developers
mailing list