From 245c7f38b2325df809f98e0ed0801d2e651103b7 Mon Sep 17 00:00:00 2001 From: Matteo Cypriani Date: Wed, 22 May 2013 18:18:26 -0400 Subject: [PATCH] CMake: "fix" static linking (remove -pie) Stop linking with -pie, as it prevents from linking statically. --- CMakeLists.txt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d05151..6700035 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 ###