diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-07-14 12:54:41 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-07-14 12:54:41 +0100 |
commit | bcde3b0e5396f3ea560d3429b8fab1d69a18a55a (patch) | |
tree | e5ac87604ddacb26643018036c43ce1a58290afa /CMakeLists.txt | |
parent | ce0579f6cca32e20c32a4e9cad567a3752c16cf2 (diff) | |
download | rspamd-bcde3b0e5396f3ea560d3429b8fab1d69a18a55a.tar.gz rspamd-bcde3b0e5396f3ea560d3429b8fab1d69a18a55a.zip |
[Feature] Use -flto if possible when optimizations are enabled
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 22704af4e..5d126659d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -793,7 +793,13 @@ ENDIF(SUPPORT_FPIC) # Optimization flags IF(NOT CMAKE_C_OPT_FLAGS) IF(ENABLE_OPTIMIZATION MATCHES "ON") - SET(CMAKE_C_OPT_FLAGS "-O3 -fstrict-aliasing") + CHECK_C_COMPILER_FLAG(-flto SUPPORT_FLTO) + IF(SUPPORT_FLTO) + SET(CMAKE_C_OPT_FLAGS "-O3 -fstrict-aliasing -flto") + SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -flto") + ELSE() + SET(CMAKE_C_OPT_FLAGS "-O3 -fstrict-aliasing") + ENDIF() ELSE(ENABLE_OPTIMIZATION MATCHES "ON") IF(DEBUG_MODE MATCHES "ON") SET(CMAKE_C_OPT_FLAGS "-g -O0 -fstrict-aliasing") |