[CMake] PIE and PIC in mixed projects

Emil Langrock emil.langrock at gmx.de
Thu Sep 9 08:20:17 EDT 2010


Ryan Pavlik wrote:
> Not sure how you're setting the LDFLAGS, but if you append -fPIE -pie to
> this variable, it should be used only for executables.
> 
> http://cmake.org/cmake/help/cmake-2-8-docs.html#variable:CMAKE_EXE_LINKER_F
> LAGS
> 
> There is an undocumented peer to this variable, something like
> CMAKE_LIBRARY_LINKER_FLAGS, (search the mailing list archives - someone
> replied to a message from me within the last month and named that variable)
> which you may consider modifying through a search/replace to remove -fPIE
> and -pie.
> 
> Ryan

Yes, LDFLAGS would be possible, but C(XX|PP)FLAGS is a lot bigger problem. I 
don't want to restrict how the variables are set. Currently they are just set 
through exported env variables. It is no problem to use CMAKE_EXE_LINKER_FLAGS 
or CMAKE_MODULE_LINKER_FLAGS or CMAKE_SHARED_LINKER_FLAGS - but the  C(XX|
PP)FLAGS are the problem when I would try to do it that way.
-- 
Emil Langrock


More information about the CMake mailing list