summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorent Castelli <florent.castelli@gmail.com>2017-01-25 05:33:36 +0100
committerFlorent Castelli <florent.castelli@gmail.com>2017-01-25 06:10:19 +0100
commitc48617008d2bbb27733cbea041db93fdca267490 (patch)
tree8f57298e825e17a5997ebf1785c218356a2292ff
parentff4ef0874509f125250894c2c0fdf8122684293b (diff)
cmake: Regroup compilation flags together
-rw-r--r--CMakeLists.txt16
1 files changed, 7 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c6769ad889..fb684b024d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -222,21 +222,19 @@ if(NOT MSVC)
check_and_add_flag(MISSING_DECLARATIONS -Wmissing-declarations)
check_and_add_flag(MISSING_VARIABLE_DECLARATIONS -Wmissing-variable-declarations)
+ # gcc uses some optimizations which might break stuff without this flag
+ check_and_add_flag(NO_STRICT_ALIASING -fno-strict-aliasing)
+ check_and_add_flag(NO_EXCEPTIONS -fno-exceptions)
+
+ check_and_add_flag(VISIBILITY_INLINES_HIDDEN -fvisibility-inlines-hidden)
+ check_and_add_flag(VISIBILITY_HIDDEN -fvisibility=hidden)
+
check_c_compiler_flag(-fomit-frame-pointer FLAG_C_FOMIT_FRAME_POINTER)
if(FLAG_C_FOMIT_FRAME_POINTER)
add_compile_options($<$<CONFIG:Release>:-fomit-frame-pointer>)
endif()
endif(NOT MSVC)
-# gcc uses some optimizations which might break stuff without this flag
-add_definitions(-fno-strict-aliasing -fno-exceptions)
-
-check_and_add_flag(VISIBILITY_INLINES_HIDDEN -fvisibility-inlines-hidden)
-
-if(UNIX AND NOT APPLE)
- check_and_add_flag(VISIBILITY_HIDDEN -fvisibility=hidden)
-endif()
-
if(ENABLE_LTO)
check_and_add_flag(LTO -flto)
if(CMAKE_CXX_COMPILER_ID STREQUAL GNU)