diff --git a/CMakeLists.txt b/CMakeLists.txt index 7ace626fe..dd3d188b9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,9 +32,10 @@ endif() option(ENABLE_CCACHE "Speed up incremental rebuilds via ccache" ON) option(ENABLE_JSON_LOGGING "Adds additional JSON debug logging to the response" OFF) option(BUILD_TOOLS "Build OSRM tools" OFF) -option(BUILD_COMPONENTS "Build OSRM tools" ON) +option(BUILD_COMPONENTS "Build osrm-components" ON) option(ENABLE_ASSERTIONS OFF) option(COVERAGE OFF) +option(SANITIZER OFF) include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}/include/) include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/include/) @@ -136,12 +137,18 @@ endif() set(MAYBE_COVERAGE_LIBRARIES "") if (COVERAGE) - if (NOT CMAKE_BUILD_TYPE MATCHES "DEBUG") + if (NOT CMAKE_BUILD_TYPE MATCHES "Debug") message(ERROR "COVERAGE=ON only make sense with a Debug build") endif() set(MAYBE_COVERAGE_LIBRARIES "gcov") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftest-coverage -fprofile-arcs") endif() +if (SANITIZER) + if (NOT CMAKE_BUILD_TYPE MATCHES "Debug") + message(ERROR "SANITIZER=ON only make sense with a Debug build") + endif() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address") +endif() # Configuring compilers if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")