summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt9
1 files changed, 8 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 791e645..cc6c88a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -40,9 +40,16 @@ macro(wlproto var_basename proto_xml_basename)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
endmacro()
-add_definitions(-D_GNU_SOURCE)
+add_definitions(-D_GNU_SOURCE -DDEBUG_OUTPUT)
set(CMAKE_C_FLAGS "-Wall -Wextra -Wno-unused-parameter -std=c99 ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wno-unused-parameter -std=c++14 ${CMAKE_CXX_FLAGS}")
+set(SANITIZER_MODE "none" CACHE STRING "Build using a specific sanitizer (e.g. 'address', 'thread', 'leak', 'undefined'), depends on compiler; default none")
+if (NOT ${SANITIZER_MODE} STREQUAL "none" AND NOT ${SANITIZER_MODE} STREQUAL "")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=${SANITIZER_MODE} -g -fno-omit-frame-pointer")
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=${SANITIZER_MODE} -g")
+ set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fsanitize=${SANITIZER_MODE} -g")
+endif()
+
add_subdirectory(src)