summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Joye <pierre.php@gmail.com>2021-08-21 17:36:52 +0700
committerPierre Joye <pierre.php@gmail.com>2021-08-21 17:36:52 +0700
commit24dd23aa842a75c8988298a057783ecb45a190fc (patch)
tree37535f6e18e08d8b3b4e9f788c5a51ab0a1ddd84
parent0a659211bd1b4681d0faa2bbcf97eb8e1123a742 (diff)
downloadlibgd-24dd23aa842a75c8988298a057783ecb45a190fc.tar.gz
add option to enable gcc ASAN in debug mode
-rw-r--r--CMakeLists.txt8
1 files changed, 6 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a3832a3..36f2dc7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -22,6 +22,7 @@ OPTION(ENABLE_WEBP "Enable WebP support" 0)
OPTION(ENABLE_HEIF "Enable HEIF support" 0)
OPTION(ENABLE_AVIF "Enable AVIF support" 0)
OPTION(ENABLE_RAQM "Enable RAQM support" 0)
+OPTION(ENABLE_ASAN "Enable (gcc) ASAN support" 0)
if (BUILD_TEST)
ENABLE_TESTING()
@@ -32,8 +33,11 @@ endif(BUILD_TEST)
# - specify CFLAGS=... on invocation of make
IF(CMAKE_COMPILER_IS_GNUCC)
# Re-enable sanitize once we find a way to filter out errors in external libraries (like HEIF)
- #SET(CMAKE_C_FLAGS_DEBUG "-g -Wall -Wextra -O0 -fsanitize=address") # will be added to CMAKE_C_FLAGS when CMAKE_BUILD_TYPE is "Debug"
- SET(CMAKE_C_FLAGS_DEBUG "-g -Wall -Wextra -O0 ") # will be added to CMAKE_C_FLAGS when CMAKE_BUILD_TYPE is "Debug"
+ if (ENABLE_ASAN)
+ SET(CMAKE_C_FLAGS_DEBUG "-g -Wall -Wextra -O0 -fsanitize=address") # will be added to CMAKE_C_FLAGS when CMAKE_BUILD_TYPE is "Debug"
+ else
+ SET(CMAKE_C_FLAGS_DEBUG "-g -Wall -Wextra -O0 ") # will be added to CMAKE_C_FLAGS when CMAKE_BUILD_TYPE is "Debug"
+ endif (ENABLE_ASAN)
ENDIF(CMAKE_COMPILER_IS_GNUCC)
SET (CMAKE_LIBRARY_OUTPUT_DIRECTORY
${PROJECT_BINARY_DIR}/Bin