mirror of
https://github.com/gbdev/rgbds.git
synced 2026-03-25 14:23:04 +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_compile_options(${SAN_FLAGS})
|
||||||
add_link_options(${SAN_FLAGS})
|
add_link_options(${SAN_FLAGS})
|
||||||
add_definitions(-D_GLIBCXX_ASSERTIONS -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG)
|
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
|
# A non-zero optimization level is desired even in debug mode (especially for Clang),
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG "-g -Og -fno-omit-frame-pointer -fno-optimize-sibling-calls ${CMAKE_CXX_FLAGS_DEBUG}"
|
# and the two codegen flags improve the sanitizers' backtraces, but we want the user to
|
||||||
CACHE STRING "" FORCE)
|
# 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()
|
endif()
|
||||||
|
|
||||||
if(MORE_WARNINGS)
|
if(MORE_WARNINGS)
|
||||||
|
|||||||
Reference in New Issue
Block a user