[cmake-developers] Adding logic to CMake for -fPIE and -fPIC

Brad King brad.king at kitware.com
Fri Jun 8 10:28:35 EDT 2012


On 06/08/2012 10:08 AM, Stephen Kelly wrote:
> David Cole wrote:
>>
>> There's also this build warning:
>>
>>   http://open.cdash.org/viewBuildError.php?type=1&buildid=2342611
>>
>> Please eradicate that, and then this topic will be ready for merging.
> 
> Any idea what causes it? 
> 
> I don't see why only that line would cause such a warning. It should be from 
> every compilation or none...
> 
> Any idea what the fix is?

That dashboard build uses "bootstrap" so CMake is built with itself.
Therefore the new build flags appear during CMake's own build which
includes the test module in KWSys.  That is the only shared library
built as part of CMake, so only that shows the warning.

The problem is in

 Modules/Platform/CYGWIN-GNU.cmake
 Modules/Platform/Windows-GNU.cmake

which currently have

 set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "") # No -fPIC on cygwin

and

 set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "") # No -fPIC on Windows

to override the Modules/Compiler/GNU.cmake settings.
They should be updated to override the PIC/PIE compile
option variables too.

-Brad



More information about the cmake-developers mailing list