diff options
author | Andrea Pappacoda <[email protected]> | 2021-11-06 22:56:00 +0100 |
---|---|---|
committer | Matthew Gregan <[email protected]> | 2021-11-09 09:32:05 +1300 |
commit | 5a64bc898cf1823a46aa1d4aa2dc1830e02c69d2 (patch) | |
tree | 2096ad46054f72335c7653fb6d703d50c94d4bbc /CMakeLists.txt | |
parent | 5d93d2dc0b94bb72541977db25b5048533f2e25f (diff) | |
download | cubeb-5a64bc898cf1823a46aa1d4aa2dc1830e02c69d2.tar.gz cubeb-5a64bc898cf1823a46aa1d4aa2dc1830e02c69d2.zip |
build: add USE_SANITIZERS option
This is useful to users who can't recursively clone the repo or that
simply want to build the project from the downloadable tarball (like
Linux distributions, for example)
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index be0e3b1..d505bfc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,7 @@ option(BUILD_TESTS "Build tests" ON) option(BUILD_RUST_LIBS "Build rust backends" OFF) option(BUILD_TOOLS "Build tools" ON) option(LAZY_LOAD_LIBS "Lazily load shared libraries" ON) +option(USE_SANITIZERS "Use sanitizers" ON) if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING @@ -20,12 +21,17 @@ set(CMAKE_C_STANDARD 99) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) -if(NOT COMMAND add_sanitizers) - list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/sanitizers-cmake/cmake") - find_package(Sanitizers) +if(USE_SANITIZERS) if(NOT COMMAND add_sanitizers) - message(FATAL_ERROR "Could not find sanitizers-cmake: run\n\tgit submodule update --init --recursive\nin base git checkout") + list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/sanitizers-cmake/cmake") + find_package(Sanitizers) + if(NOT COMMAND add_sanitizers) + message(FATAL_ERROR "Could not find sanitizers-cmake: run\n\tgit submodule update --init --recursive\nin base git checkout") + endif() endif() +else() + macro(add_sanitizers UNUSED) + endmacro() endif() if(BUILD_TESTS) |