Skip to content
Snippets Groups Projects
Commit aea41d38 authored by Lars Bilke's avatar Lars Bilke
Browse files

[CMake] Added Clang sanitizer options.

parent ae0f634b
No related branches found
No related tags found
No related merge requests found
...@@ -10,6 +10,9 @@ ...@@ -10,6 +10,9 @@
- Added CMake option `OGS_CPU_ARCHITECTURE`, #858, [downloadable binaries](http://docs.opengeosys.org/download) build by Jenkins should now run on more CPUs - Added CMake option `OGS_CPU_ARCHITECTURE`, #858, [downloadable binaries](http://docs.opengeosys.org/download) build by Jenkins should now run on more CPUs
- Added CMake options for Boost, VTK and Eigen (`OGS_LIB_BOOST`, ...) to specify if libs are searched on the system first, then build them locally (`Default`), or you can specify to just use system libs (`System`) or force a local build (`Local`) - Added CMake options for Boost, VTK and Eigen (`OGS_LIB_BOOST`, ...) to specify if libs are searched on the system first, then build them locally (`Default`), or you can specify to just use system libs (`System`) or force a local build (`Local`)
- Added CMake options for enabling Clang sanitizer:
- `OGS_ADDRESS_SANITIZER`
- `OGS_UNDEFINED_BEHAVIOR_SANITIZER`
### Documentation ### Documentation
......
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "3.6")
return()
endif()
option(OGS_ADDRESS_SANITIZER OFF "Use Clangs AddressSanitizer")
option(OGS_UNDEFINED_BEHAVIOR_SANITIZER OFF "Use Clangs UndefinedBehaviorSanitizer")
if(OGS_ADDRESS_SANITIZER)
set(SANITIZE_FLAG_VALUE "address")
set(ADDITIONAL_FLAGS "-fno-omit-frame-pointer")
endif()
if(OGS_UNDEFINED_BEHAVIOR_SANITIZER)
set(SANITIZE_FLAG_VALUE "${SANITIZE_FLAG_VALUE},undefined")
endif()
if(DEFINED SANITIZE_FLAG_VALUE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=${SANITIZE_FLAG_VALUE} ${ADDITIONAL_FLAGS}")
endif()
...@@ -61,6 +61,9 @@ if(COMPILER_IS_CLANG) ...@@ -61,6 +61,9 @@ if(COMPILER_IS_CLANG)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_ASSERT -D_GLIBCXX_DEBUG_PEDASSERT -D_GLIBCXX_DEBUG_VERIFY") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_ASSERT -D_GLIBCXX_DEBUG_PEDASSERT -D_GLIBCXX_DEBUG_VERIFY")
endif() endif()
endif() endif()
include(ClangSanitizer)
endif() # COMPILER_IS_CLANG endif() # COMPILER_IS_CLANG
### Intel compiler ### Intel compiler
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment