mirror of
https://github.com/gbdev/rgbds.git
synced 2026-03-25 06:13:03 +00:00
Tidy up CMake sanitizer flags
Set the flags in the build itself instead of trying to override the cache (this was an artifact of when I didn't understand the CMake variable model), which avoids them being duplicated on each re-configuration. Also remove `-g`, since it's defined by the build type by default (we leave it up to the user to choose Debug or RelWithDebInfo).
This commit is contained in:
@@ -59,9 +59,10 @@ else()
|
||||
add_compile_options(${SAN_FLAGS})
|
||||
add_link_options(${SAN_FLAGS})
|
||||
add_definitions(-D_GLIBCXX_ASSERTIONS -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG)
|
||||
# A non-zero optimization level is desired in debug mode, but allow overriding it nonetheless
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-g -Og -fno-omit-frame-pointer -fno-optimize-sibling-calls ${CMAKE_CXX_FLAGS_DEBUG}"
|
||||
CACHE STRING "" FORCE)
|
||||
# A non-zero optimization level is desired even in debug mode (especially for Clang),
|
||||
# and the two codegen flags improve the sanitizers' backtraces, but we want the user to
|
||||
# be able to override these easily so we put them first.
|
||||
string(PREPEND CMAKE_CXX_FLAGS_DEBUG "-Og -fno-omit-frame-pointer -fno-optimize-sibling-calls ")
|
||||
endif()
|
||||
|
||||
if(MORE_WARNINGS)
|
||||
|
||||
Reference in New Issue
Block a user