summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2019-12-11 22:48:55 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2019-12-11 22:49:34 (GMT)
commit74524c5a351d730e1b01c4ac4ed29ae71cab6b56 (patch)
treeccf16a0b261c06265c6ab89738927425c53da41c /CMakeLists.txt
parent8026c67a1c34e9d3dcaffe12f22d00e4ced64878 (diff)
downloadhdf5-74524c5a351d730e1b01c4ac4ed29ae71cab6b56.zip
hdf5-74524c5a351d730e1b01c4ac4ed29ae71cab6b56.tar.gz
hdf5-74524c5a351d730e1b01c4ac4ed29ae71cab6b56.tar.bz2
TRILABS-135 Add clang analyzers
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 ()