Browse Source

address sanitizer configuration option have been added

pull/638/head
brain5lug 8 years ago
parent
commit
6c7316408b
  1. 11
      build/CMakeLists.txt

11
build/CMakeLists.txt

@ -16,6 +16,7 @@ option(WITH_UPNP "Include support for UPnP client" OFF) @@ -16,6 +16,7 @@ option(WITH_UPNP "Include support for UPnP client" OFF)
option(WITH_PCH "Use precompiled header" OFF)
option(WITH_GUI "Include GUI (currently MS Windows only)" ON)
option(WITH_MESHNET "Build for cjdns test network" OFF)
option(WITH_ADDRSANITIZER "Build with address sanitizer (linux only)" OFF)
# paths
set ( CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules" )
@ -183,6 +184,15 @@ if (WITH_AESNI) @@ -183,6 +184,15 @@ if (WITH_AESNI)
add_definitions ( -DAESNI )
endif()
if (WITH_ADDRSANITIZER)
if (NOT MSVC)
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer" )
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address" )
else ()
error ("MSVC does not support address sanitizer option")
endif()
endif()
# libraries
# TODO: once CMake 3.1+ becomes mainstream, see e.g. http://stackoverflow.com/a/29871891/673826
# use imported Threads::Threads instead
@ -335,6 +345,7 @@ message(STATUS " STATIC BUILD : ${WITH_STATIC}") @@ -335,6 +345,7 @@ message(STATUS " STATIC BUILD : ${WITH_STATIC}")
message(STATUS " UPnP : ${WITH_UPNP}")
message(STATUS " PCH : ${WITH_PCH}")
message(STATUS " MESHNET : ${WITH_MESHNET}")
message(STATUS " ADDRSANITIZER : ${WITH_ADDRSANITIZER}")
message(STATUS "---------------------------------------")
#Handle paths nicely

Loading…
Cancel
Save