@@ -427,15 +427,12 @@ target_compile_definitions(core_interface_debug INTERFACE
427427)
428428# We leave assertions on.
429429if (MSVC )
430- remove_c_flag_from_all_configs(/DNDEBUG)
431430 remove_cxx_flag_from_all_configs(/DNDEBUG)
432431else ()
433- remove_c_flag_from_all_configs(-DNDEBUG)
434432 remove_cxx_flag_from_all_configs(-DNDEBUG)
435433
436- # Adjust flags used by the C/ CXX compiler during RELEASE builds.
434+ # Adjust flags used by the CXX compiler during RELEASE builds.
437435 # Prefer -O2 optimization level. (-O3 is CMake's default for Release for many compilers.)
438- replace_c_flag_in_config(Release -O3 -O2)
439436 replace_cxx_flag_in_config(Release -O3 -O2)
440437
441438 are_flags_overridden(CMAKE_CXX_FLAGS_DEBUG cxx_flags_debug_overridden)
@@ -445,6 +442,7 @@ else()
445442 if (compiler_supports_g3)
446443 replace_cxx_flag_in_config(Debug -g -g3)
447444 endif ()
445+ unset (compiler_supports_g3)
448446
449447 try_append_cxx_flags("-ftrapv" RESULT_VAR compiler_supports_ftrapv)
450448 if (compiler_supports_ftrapv)
@@ -461,24 +459,6 @@ else()
461459 )
462460 endif ()
463461 unset (cxx_flags_debug_overridden)
464-
465- are_flags_overridden(CMAKE_C_FLAGS_DEBUG c_flags_debug_overridden)
466- if (NOT c_flags_debug_overridden)
467- # Redefine flags used by the C compiler during DEBUG builds.
468- if (compiler_supports_g3)
469- replace_c_flag_in_config(Debug -g -g3)
470- endif ()
471-
472- string (PREPEND CMAKE_C_FLAGS_DEBUG "-O0 " )
473-
474- set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} "
475- CACHE STRING
476- "Flags used by the C compiler during DEBUG builds."
477- FORCE
478- )
479- endif ()
480- unset (compiler_supports_g3)
481- unset (c_flags_debug_overridden)
482462endif ()
483463
484464include (cmake/optional .cmake)
0 commit comments