[cmake-developers] Adding logic to CMake for -fPIE and -fPIC
Stephen Kelly
steveire at gmail.com
Tue Jun 5 13:23:24 EDT 2012
Brad King wrote:
> On 06/05/2012 11:54 AM, Stephen Kelly wrote:
>> I can add a try_compile for -fPIE on APPLE (though I wonder if it would
>> work), but still, I expect to see something like that in the OUTPUT
>> variable from check_cxx_source_compiles...
>
> The OUTPUT variable is internal to the macro and not documented as holding
> anything when the call returns. A quick glance doesn't tell me why the
> value isn't leaking out as an implementation detail though.
>
> You can't try_compile inside a platform file.
I'm not sure I'm trying to?
> It's too early in the
> init process because the platform files are needed to generate inside
> the try_compile. You would have to run your own execute_process and
> invoke the compiler directly. I suggest checking the compiler version
> rather than testing the flag. Just checking CMAKE_C_COMPILER_VERSION
> might be enough in this case.
Do you mean in the tests, or do you mean the POSITION_INDEPENDENT_CODE
feature should be disabled for older GCC?
Thanks,
Steve.
More information about the cmake-developers
mailing list