summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortastytea2022-11-13 06:06:26 +0100
committertastytea2022-11-13 06:17:34 +0100
commite74828c19ec238b14ff77fe57f86059f8f2b0892 (patch)
tree56a64f1b74feb9904fe3e2b5a78589bda45124f0
parent7255df01e047da9bf88dcb6945d07b49126e24b4 (diff)
downloadmastodonpp-e74828c19ec238b14ff77fe57f86059f8f2b0892.tar
mastodonpp-e74828c19ec238b14ff77fe57f86059f8f2b0892.tar.gz
mastodonpp-e74828c19ec238b14ff77fe57f86059f8f2b0892.zip
don't add -fsanitize=undefined if MinGW is used
Reported-by: Ben S.
-rw-r--r--cmake/debug_flags.cmake21
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