diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-07-14 12:59:37 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-07-14 12:59:37 +0100 |
commit | fcea960519650da608d4c3ad1dec784f546eb930 (patch) | |
tree | 1167246838f022190a14a15ed9718a665a3bfcb7 /CMakeLists.txt | |
parent | bcde3b0e5396f3ea560d3429b8fab1d69a18a55a (diff) | |
download | rspamd-fcea960519650da608d4c3ad1dec784f546eb930.tar.gz rspamd-fcea960519650da608d4c3ad1dec784f546eb930.zip |
[Fix] PIE is required for static build
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 8 |
1 files changed, 8 insertions, 0 deletions
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") |