cmake: Use new option in check_and_add_flag to add options correctly

Previously, -ggdb wouldn't be added when using the Xcode generator.
And now, the code for -fomit-frame-pointer is much more simple.
This commit is contained in:
Florent Castelli 2017-01-25 16:19:35 +01:00
parent 00c15d84d6
commit f5fd5477e3
1 changed files with 2 additions and 5 deletions

View File

@ -225,10 +225,8 @@ else()
check_and_add_flag(VISIBILITY_INLINES_HIDDEN -fvisibility-inlines-hidden) check_and_add_flag(VISIBILITY_INLINES_HIDDEN -fvisibility-inlines-hidden)
check_and_add_flag(VISIBILITY_HIDDEN -fvisibility=hidden) check_and_add_flag(VISIBILITY_HIDDEN -fvisibility=hidden)
check_c_compiler_flag(-fomit-frame-pointer FLAG_C_FOMIT_FRAME_POINTER) check_and_add_flag(FOMIT_FRAME_POINTER -fomit-frame-pointer RELEASE_ONLY)
if(FLAG_C_FOMIT_FRAME_POINTER) check_and_add_flag(GGDB -ggdb DEBUG_ONLY)
add_compile_options($<$<CONFIG:Release>:-fomit-frame-pointer>)
endif()
if(NOT ANDROID AND _M_X86_64) if(NOT ANDROID AND _M_X86_64)
# PIE is required on Android, but not supported with the x86_64 jit currently # PIE is required on Android, but not supported with the x86_64 jit currently
@ -337,7 +335,6 @@ endif()
if(CMAKE_BUILD_TYPE STREQUAL "Debug") if(CMAKE_BUILD_TYPE STREQUAL "Debug")
add_definitions(-D_DEBUG) add_definitions(-D_DEBUG)
check_and_add_flag(GGDB -ggdb)
option(ENABLE_GPROF "Enable gprof profiling (must be using Debug build)" OFF) option(ENABLE_GPROF "Enable gprof profiling (must be using Debug build)" OFF)
if(ENABLE_GPROF) if(ENABLE_GPROF)