CMake: "fix" static linking (remove -pie)

Stop linking with -pie, as it prevents from linking statically.
This commit is contained in:
Matteo Cypriani 2013-05-22 18:18:26 -04:00
parent 2bfd0ee009
commit 245c7f38b2
1 changed files with 8 additions and 4 deletions

View File

@ -108,10 +108,14 @@ if ("${CMAKE_SHARED_LINKER_FLAGS}" STREQUAL " ")
endif()
# Linker flags when linking an executable
if ("${CMAKE_EXE_LINKER_FLAGS}" STREQUAL " ")
set(CMAKE_EXE_LINKER_FLAGS "-pie -fPIE"
CACHE STRING "Set default shared linker flags" FORCE)
endif()
# Note: -fpie prevents from building static executables, therefore it
# has been deactivated, but it would be nice to find a work-around
# to allow building dynamic (and semistatic) targets with -pie and
# static ones without.
#if ("${CMAKE_EXE_LINKER_FLAGS}" STREQUAL " ")
# set(CMAKE_EXE_LINKER_FLAGS "-pie -fPIE"
# CACHE STRING "Set default shared linker flags" FORCE)
#endif()
### Libraries targets ###