diff options
author | Mathias Preiner <mathias.preiner@gmail.com> | 2018-08-17 16:59:09 -0700 |
---|---|---|
committer | Mathias Preiner <mathias.preiner@gmail.com> | 2018-09-22 16:30:59 -0700 |
commit | b812d3303748704d5582a16a5d095d03955fe900 (patch) | |
tree | 584bc95b99520bdaf6b0f360502aadf19363587b /CMakeLists.txt | |
parent | 4498efe1c6392572fd1b6de6dca814d630b1f834 (diff) |
cmake: Add ASAN support.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index aa4f5fa79..204e10169 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -132,6 +132,7 @@ option(ENABLE_GPL "Enable GPL dependencies" OFF) # General build options # >> 3-valued: INGORE ON OFF, allows to detect if set by user # this is only necessary for options set for build types! +cvc4_option(ENABLE_ASAN "Enable ASAN build") cvc4_option(ENABLE_ASSERTIONS "Enable assertions") cvc4_option(ENABLE_DEBUG_SYMBOLS "Enable debug symbols") cvc4_option(ENABLE_DUMPING "Enable dumpin") @@ -191,12 +192,17 @@ include_directories(${GMP_INCLUDE_DIR}) add_check_c_cxx_flag("-O${OPT_LEVEL}") add_check_c_flag("-fexceptions") add_check_c_cxx_flag("-Wno-deprecated") -add_check_c_cxx_flag("-Wsuggest-override") +add_check_cxx_flag("-Wsuggest-override") add_check_cxx_flag("-Wnon-virtual-dtor") #-----------------------------------------------------------------------------# # Build types +if(ENABLE_ASAN) + set(CMAKE_BUILD_TYPE Debug) +endif() + +# Set the default build type to Production if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Production CACHE STRING "Options are: ${BUILD_TYPES}" FORCE) # Provide drop down menu options in cmake-gui @@ -220,6 +226,14 @@ endif() #-----------------------------------------------------------------------------# +if(ENABLE_ASAN) + set(CMAKE_REQUIRED_LIBRARIES -fsanitize=address) + add_required_c_cxx_flag("-fsanitize=address") + unset(CMAKE_REQUIRED_LIBRARIES) + add_required_c_cxx_flag("-fno-omit-frame-pointer") + add_check_c_cxx_flag("-fsanitize-recover=address") +endif() + if(ENABLE_ASSERTIONS) add_definitions(-DCVC4_ASSERTIONS) endif() |