From: Vsevolod Stakhov Date: Thu, 14 Jul 2016 11:59:37 +0000 (+0100) Subject: [Fix] PIE is required for static build X-Git-Tag: 1.3.0~89 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=fcea960519650da608d4c3ad1dec784f546eb930;p=rspamd.git [Fix] PIE is required for static build --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 5d126659d..f37cfb4f8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -790,6 +790,14 @@ IF(SUPPORT_FPIC) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") ENDIF(SUPPORT_FPIC) +CHECK_C_COMPILER_FLAG(-fPIE SUPPORT_FPIE) +IF(ENABLE_STATIC MATCHES "ON") + IF(SUPPORT_FPIE) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIE") + SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie") + ENDIF() +ENDIF() + # Optimization flags IF(NOT CMAKE_C_OPT_FLAGS) IF(ENABLE_OPTIMIZATION MATCHES "ON")