diff options
-rw-r--r-- | cmake/debug_flags.cmake | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/cmake/debug_flags.cmake b/cmake/debug_flags.cmake index 6f177d9..76d77fb 100644 --- a/cmake/debug_flags.cmake +++ b/cmake/debug_flags.cmake @@ -22,7 +22,6 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" "-Wdouble-promotion" "-Wformat=2" "-ftrapv" - "-fsanitize=undefined" "-Og" "-fno-omit-frame-pointer") if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") @@ -40,15 +39,21 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" endif() endif() endif() + if(NOT MINGW) + list(APPEND DEBUG_CXXFLAGS + "-fsanitize=undefined") + endif() add_compile_options("$<$<CONFIG:Debug>:${DEBUG_CXXFLAGS}>") - set(DEBUG_LDFLAGS - "-fsanitize=undefined") - # add_link_options was introduced in version 3.13. - if(${CMAKE_VERSION} VERSION_LESS 3.13) - set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${DEBUG_LDFLAGS}") - else() - add_link_options("$<$<CONFIG:Debug>:${DEBUG_LDFLAGS}>") + if(NOT MINGW) + set(DEBUG_LDFLAGS + "-fsanitize=undefined") + # add_link_options was introduced in version 3.13. + if(${CMAKE_VERSION} VERSION_LESS 3.13) + set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${DEBUG_LDFLAGS}") + else() + add_link_options("$<$<CONFIG:Debug>:${DEBUG_LDFLAGS}>") + endif() endif() else() message(STATUS |