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

Brad King brad.king at kitware.com
Wed May 30 13:34:09 EDT 2012


On 05/30/2012 12:26 PM, Stephen Kelly wrote:
> What a mess. Sorry about that.
> 
> Updated now.

Great, that looks pretty good.  A couple more comments:

The KWStyle test fails due to a few lines too long.  Use:

 $ git log master.. -p --pickaxe-regex -S.{80} -- Source

to look for hunks that add them.  Some day I'll put that
in the local pre-commit check.

Also the code near calls to GetShouldUseOldFlags is not
indented with our convention.

The commit that adds CMAKE_POSITION_INDEPENDENT_CODE
for initialization should add it to cmDocumentVariables.

Why is the test added as a "Module." test?

Remaining tasks include:

(1) The Xcode generator calls AddSharedFlags.  I do not think
the VS IDE generators ever used the old variable at all.  FYI,
it seems that calls to AddSharedFlags have been slowly
disappearing over the years for various reasons, such as here:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=65b6a8f5

Your CMP0018, once implemented for Xcode, will remove the
last of the calls to AddSharedFlags when set to NEW :)

(2) CMAKE_SHARED_LIBRARY_${lang}_FLAGS is still used in
cmLocalGenerator::GetTargetFlags for compiling executable
sources.  I don't think that's actually correct though.
It was added here:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7cef36c6#patch3

but that code path was never really used until the Ninja
generator and "cmake --find-package" started using
GetTargetFlags.  I think we can just drop this use of the
variable.

-Brad



More information about the cmake-developers mailing list