summaryrefslogtreecommitdiffstats
path: root/config/sanitizer/sanitizers.cmake
diff options
context:
space:
mode:
authorAllen Byrne <50328838+byrnHDF@users.noreply.github.com>2021-08-17 13:38:28 (GMT)
committerGitHub <noreply@github.com>2021-08-17 13:38:28 (GMT)
commit23699c151bf99ce0c81c786b58d6da187dedd911 (patch)
tree1d75a72d82e66cce50f3f9e70a69207fd18cb6d7 /config/sanitizer/sanitizers.cmake
parent9992505ebeb99f550e5be45db57b0f28105bfb53 (diff)
downloadhdf5-23699c151bf99ce0c81c786b58d6da187dedd911.zip
hdf5-23699c151bf99ce0c81c786b58d6da187dedd911.tar.gz
hdf5-23699c151bf99ce0c81c786b58d6da187dedd911.tar.bz2
Fix clang/sanitizer for windows #883 (#902)
Diffstat (limited to 'config/sanitizer/sanitizers.cmake')
-rw-r--r--config/sanitizer/sanitizers.cmake10
1 files changed, 5 insertions, 5 deletions
diff --git a/config/sanitizer/sanitizers.cmake b/config/sanitizer/sanitizers.cmake
index 0803279..22b9e3c 100644
--- a/config/sanitizer/sanitizers.cmake
+++ b/config/sanitizer/sanitizers.cmake
@@ -33,10 +33,10 @@ if(USE_SANITIZER)
if(INTEL_CLANG OR "${CMAKE_C_COMPILER_ID}" MATCHES "Clang")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
- append("-fno-omit-frame-pointer" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS)
- message(STATUS "Building with sanitize, base flags=${CMAKE_C_SANITIZER_FLAGS}")
-
if(UNIX)
+ append("-fno-omit-frame-pointer" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS)
+ message(STATUS "Building with sanitize, base flags=${CMAKE_C_SANITIZER_FLAGS}")
+
if(uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG")
append("-O1" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS)
endif()
@@ -80,10 +80,10 @@ if(USE_SANITIZER)
message(
FATAL_ERROR "Unsupported value of USE_SANITIZER: ${USE_SANITIZER}")
endif()
- elseif(MSVC)
+ elseif(MSVC AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 19.29)
if(USE_SANITIZER MATCHES "([Aa]ddress)")
message(STATUS "Building with Address sanitizer")
- append("-fsanitize=address" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS)
+ append("/fsanitize=address" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS)
else()
message(FATAL_ERROR "This sanitizer not yet supported in the MSVC environment: ${USE_SANITIZER}")
endif()