summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2019-12-11 22:48:55 (GMT)
committerDavid Young <dyoung@hdfgroup.org>2020-05-20 14:20:20 (GMT)
commit371439c6bd11a3c5444e45937182af5386353a57 (patch)
treee2b4b977445deedb0cbdd02a240afdd41b7d29d7 /CMakeLists.txt
parent958ba4c8a269329f1d5771864af33a5ca3ac36c4 (diff)
downloadhdf5-371439c6bd11a3c5444e45937182af5386353a57.zip
hdf5-371439c6bd11a3c5444e45937182af5386353a57.tar.gz
hdf5-371439c6bd11a3c5444e45937182af5386353a57.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 ()