aboutsummaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2024-07-25 11:31:16 +0000
committersaturneric <[email protected]>2024-07-25 11:31:16 +0000
commit6728888b87806328b05f30b15825d05ca34026bc (patch)
tree2376e198984f1770cd3e240469e550fb4fef101d /CMakeLists.txt
parentfeat: update mimalloc to v2.1.7 (diff)
downloadGpgFrontend-6728888b87806328b05f30b15825d05ca34026bc.tar.gz
GpgFrontend-6728888b87806328b05f30b15825d05ca34026bc.zip
feat: add an ASAN option to enable a memory debugging mode
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt16
1 files changed, 15 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8e21e33f..49cd9853 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -68,7 +68,7 @@ option(GPGFRONTEND_BUILD_TYPE_STABLE
option(GPGFRONTEND_BUILD_TYPE_SDK "Generate a usable SDK" OFF)
option(GPGFRONTEND_QT5_BUILD "Swith to Qt5 building mode" OFF)
option(GPGFRONTEND_GENERATE_LINUX_INSTALL_SOFTWARE "Generate an installable version" OFF)
-
+option(GPGFRONTEND_ENABLE_ASAN "Enable ASAN" OFF)
option(GPGFRONTEND_XCODE_TEAM_ID "GpgFrontend Apple Team ID" "NONE")
option(GPGFRONTEND_XOCDE_CODE_SIGN_IDENTITY "GpgFrontend Signing Certificate" "NONE")
@@ -207,6 +207,20 @@ if (CMAKE_BUILD_TYPE STREQUAL "Release" AND APPLE)
unset(GPGFRONTEND_BUILD_CONFIG)
endif ()
+# if enable ASAN
+if(GPGFRONTEND_ENABLE_ASAN)
+
+ # check compiler
+ if(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+ message(FATAL_ERROR "Use GPGFRONTEND_ENABLE_ASAN only when using the clang compiler.")
+ endif()
+
+ add_compile_options(-fsanitize=address)
+ add_link_options(-fsanitize=address)
+
+ set(ENABLE_ASAN 1)
+endif()
+
set(AppName GpgFrontend)
# Get Git Information