summaryrefslogtreecommitdiffstats
path: root/config/sanitizer
diff options
context:
space:
mode:
authorAllen Byrne <50328838+byrnHDF@users.noreply.github.com>2022-01-24 13:46:17 (GMT)
committerGitHub <noreply@github.com>2022-01-24 13:46:17 (GMT)
commit4d45d05078fb1f67cc449fd5a6826c6dcfe55bfe (patch)
treee54b0944d8943947e7505d86a79fe71e6a1c9ba9 /config/sanitizer
parent99d3962a831167298ebc087f0b8e8b6209034d95 (diff)
downloadhdf5-4d45d05078fb1f67cc449fd5a6826c6dcfe55bfe.zip
hdf5-4d45d05078fb1f67cc449fd5a6826c6dcfe55bfe.tar.gz
hdf5-4d45d05078fb1f67cc449fd5a6826c6dcfe55bfe.tar.bz2
Fix cmake dynamic analysis on windows (#1373)
* Fix sanitizer flag form on windows * Add search paths to windows code-coverage
Diffstat (limited to 'config/sanitizer')
-rw-r--r--config/sanitizer/code-coverage.cmake15
-rw-r--r--config/sanitizer/sanitizers.cmake11
2 files changed, 21 insertions, 5 deletions
diff --git a/config/sanitizer/code-coverage.cmake b/config/sanitizer/code-coverage.cmake
index c79aeac..e71bfd7 100644
--- a/config/sanitizer/code-coverage.cmake
+++ b/config/sanitizer/code-coverage.cmake
@@ -80,10 +80,17 @@ option(
OFF)
# Programs
-find_program(LLVM_COV_PATH llvm-cov)
-find_program(LLVM_PROFDATA_PATH llvm-profdata)
-find_program(LCOV_PATH lcov)
-find_program(GENHTML_PATH genhtml)
+if(WIN32)
+ find_program(LLVM_COV_PATH llvm-cov PATHS ENV VS2019INSTALLDIR PATH_SUFFIXES "VC/Tools/Llvm/x64/bin")
+ find_program(LLVM_PROFDATA_PATH llvm-profdata PATHS ENV VS2019INSTALLDIR PATH_SUFFIXES "VC/Tools/Llvm/x64/bin")
+ find_program(LCOV_PATH lcov PATHS ENV VS2019INSTALLDIR PATH_SUFFIXES "VC/Tools/Llvm/x64/bin")
+ find_program(GENHTML_PATH genhtml PATHS ENV VS2019INSTALLDIR PATH_SUFFIXES "VC/Tools/Llvm/x64/bin")
+else()
+ find_program(LLVM_COV_PATH llvm-cov)
+ find_program(LLVM_PROFDATA_PATH llvm-profdata)
+ find_program(LCOV_PATH lcov)
+ find_program(GENHTML_PATH genhtml)
+endif()
# Variables
set(CMAKE_COVERAGE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/ccov)
diff --git a/config/sanitizer/sanitizers.cmake b/config/sanitizer/sanitizers.cmake
index 8bf1d5b..b06992f 100644
--- a/config/sanitizer/sanitizers.cmake
+++ b/config/sanitizer/sanitizers.cmake
@@ -83,12 +83,21 @@ if(USE_SANITIZER)
elseif(MSVC)
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()
else()
message(FATAL_ERROR "USE_SANITIZER is not supported on this platform.")
endif()
+ elseif(MSVC)
+ if(USE_SANITIZER MATCHES "([Aa]ddress)")
+ message(STATUS "Building with Address sanitizer")
+ 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()
+ else()
+ message(FATAL_ERROR "USE_SANITIZER is not supported on this platform.")
endif()
endif()