]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] PIE is required for static build
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 14 Jul 2016 11:59:37 +0000 (12:59 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 14 Jul 2016 11:59:37 +0000 (12:59 +0100)
CMakeLists.txt

index 5d126659deec9548a2c9c53e6f8d08cd11775d0d..f37cfb4f872850e6fc9e13eefb96b336bee7576b 100644 (file)
@@ -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")