diff options
-rw-r--r-- | cmake/Sanitizer.cmake | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/cmake/Sanitizer.cmake b/cmake/Sanitizer.cmake index 58a240f6f..b13e418e3 100644 --- a/cmake/Sanitizer.cmake +++ b/cmake/Sanitizer.cmake @@ -4,9 +4,17 @@ option (SANITIZE "Enable sanitizer: address, memory, undefined, leak (comma sepa set (SAN_FLAGS "${SAN_FLAGS} -g -fno-omit-frame-pointer -DSANITIZER") # O1 is normally set by clang, and -Og by gcc if (COMPILER_GCC) - set (SAN_FLAGS "${SAN_FLAGS} -Og") + if (ENABLE_FULL_DEBUG MATCHES "ON") + set (SAN_FLAGS "${SAN_FLAGS} -O0") + else() + set (SAN_FLAGS "${SAN_FLAGS} -Og") + endif() else () - set (SAN_FLAGS "${SAN_FLAGS} -O1") + if (ENABLE_FULL_DEBUG MATCHES "ON") + set (SAN_FLAGS "${SAN_FLAGS} -O0") + else() + set (SAN_FLAGS "${SAN_FLAGS} -O1") + endif() endif () if (SANITIZE) if (ENABLE_JEMALLOC MATCHES "ON") |