summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt27
1 files changed, 21 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7ae0833..63c36b0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -394,6 +394,9 @@ HDF_DIR_PATHS(${HDF5_PACKAGE_NAME})
include (${HDF_RESOURCES_EXT_DIR}/HDFLibMacros.cmake)
include (${HDF_RESOURCES_DIR}/HDF5Macros.cmake)
+if (HDF5_ENABLE_SANITIZERS)
+ include (${HDF5_SOURCE_DIR}/config/sanitizer/sanitizers.cmake)
+endif ()
#-----------------------------------------------------------------------------
# Targets built within this project are exported at Install time for use
@@ -456,18 +459,30 @@ if (BUILD_STATIC_EXECS)
endif ()
endif ()
+if (HDF5_ENABLE_ANALYZER_TOOLS)
+ include (${HDF5_SOURCE_DIR}/config/sanitizer/tools.cmake)
+endif ()
+if (HDF5_ENABLE_SANITIZERS)
+ include (${HDF5_SOURCE_DIR}/config/sanitizer/sanitizers.cmake)
+endif ()
+
#-----------------------------------------------------------------------------
# Option to use code coverage
#-----------------------------------------------------------------------------
option (HDF5_ENABLE_COVERAGE "Enable code coverage for Libraries and Programs" OFF)
if (HDF5_ENABLE_COVERAGE)
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 --coverage -fprofile-arcs -ftest-coverage")
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g --coverage -O0 -fprofile-arcs -ftest-coverage")
- if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
- set (LDFLAGS "${LDFLAGS} -fprofile-arcs -ftest-coverage")
- link_libraries (gcov)
+ include (${HDF5_SOURCE_DIR}/config/sanitizer/code-coverage.cmake)
+ if(CODE_COVERAGE AND CODE_COVERAGE_ADDED)
+ add_code_coverage() # Adds instrumentation to all targets
else ()
- set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")
+ set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 --coverage -fprofile-arcs -ftest-coverage")
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g --coverage -O0 -fprofile-arcs -ftest-coverage")
+ if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
+ set (LDFLAGS "${LDFLAGS} -fprofile-arcs -ftest-coverage")
+ link_libraries (gcov)
+ else ()
+ set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")
+ endif ()
endif ()
endif ()