diff --git a/CMakeLists.txt b/CMakeLists.txt index 59c4474894..c6769ad889 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -221,6 +221,11 @@ if(NOT MSVC) check_and_add_flag(INIT_SELF -Winit-self) check_and_add_flag(MISSING_DECLARATIONS -Wmissing-declarations) check_and_add_flag(MISSING_VARIABLE_DECLARATIONS -Wmissing-variable-declarations) + + check_c_compiler_flag(-fomit-frame-pointer FLAG_C_FOMIT_FRAME_POINTER) + if(FLAG_C_FOMIT_FRAME_POINTER) + add_compile_options($<$:-fomit-frame-pointer>) + endif() endif(NOT MSVC) # gcc uses some optimizations which might break stuff without this flag @@ -343,10 +348,6 @@ if(CMAKE_BUILD_TYPE STREQUAL Debug) endif() endif(CMAKE_BUILD_TYPE STREQUAL Debug) -if(CMAKE_BUILD_TYPE STREQUAL Release AND NOT APPLE) - add_definitions(-fomit-frame-pointer) -endif() - if(FASTLOG) add_definitions(-DDEBUGFAST) endif()