summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorAllen Winter <allen.winter@kdab.com>2016-08-28 17:33:32 -0400
committerAllen Winter <allen.winter@kdab.com>2016-08-28 17:33:32 -0400
commit4d257d0cfd0c4585d0799faf66250e84527893c1 (patch)
tree90fc0c8dab032823d56c466f70c9a85bbdc33b87 /CMakeLists.txt
parent1fbc5f0965df43dc1b516fcedcbc6203a12d295b (diff)
downloadlibical-git-4d257d0cfd0c4585d0799faf66250e84527893c1.tar.gz
CMakeLists.txt - add new developer-only option for address sanitizer
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt19
1 files changed, 18 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6a472c3f..0173e1a8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -67,8 +67,12 @@
## Special CMake Options for Developers
#
# -DABI_DUMPER=[true|false]
-# Build for the abi-dumper
+# Build for the abi-dumper (requires gcc)
# Default=false
+#
+# -DADDRESS_SANITIZER=[true|false]
+# Build with the address sanitizer (requires gcc or clang)
+#
cmake_minimum_required(VERSION 2.8.9) #first line, to shutup a cygwin warning
project(libical C CXX)
@@ -341,6 +345,19 @@ if(ABI_DUMPER)
"You are trying to build for the abi-dumper using a non-GCC compiler.")
endif()
endif()
+
+option(ADDRESS_SANITIZER "Build with the address sanitizer." False)
+if(ADDRESS_SANITIZER)
+ if(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -g")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -g")
+ set(ICAL_GLIB False)
+ else()
+ message(FATAL_ERROR
+ "You are trying to build with the address sanitizer using a non-GCC or Clang compiler.")
+ endif()
+endif()
+
########################################################
option(WITH_CXX_BINDINGS "Build the C++ bindings." True)