diff options
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") |