[CMake] -fPIC and precompiled header
frederic heem
frederic.heem at telsey.it
Wed Dec 20 11:53:48 EST 2006
Hi,
Is there a nice way to find out if a target is using -fPIC ?
Indeed, this information is needed for generating compiled header.
At the moment, a kludge is to use the following code:
#If the target is a shared library, add -fPIC to compile
GET_TARGET_PROPERTY(_targetType ${_targetName} TYPE)
IF(${_targetType} STREQUAL SHARED_LIBRARY)
SET(_compile_FLAGS "${_compile_FLAGS} -fPIC")
ENDIF(${_targetType} STREQUAL SHARED_LIBRARY)
This works but is not a proper solution, one shall not know in which
case -fPIC is used or not.
Thanks,
Frederic Heem
More information about the CMake
mailing list