diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2021-03-30 12:06:32 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2021-03-31 08:03:04 -0700 |
commit | 0521f79fae14983b9efa4b782d3ec347a59b3e8d (patch) | |
tree | ea5f0cefcc6d4836874fa93ff5c32736a32ce2da /CMakeLists.txt | |
parent | a988e3c135f8ad356b91edaede706770f5a3ab74 (diff) | |
download | subsurface-0521f79fae14983b9efa4b782d3ec347a59b3e8d.tar.gz |
build-system: make ASAN builds easier
This is a bit lacking sophistication (you need to remember to make clean
before rebuilding when changing this option, etc), but it works well
enough for my purpuses.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 031f6b819..5850462f7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,6 +29,9 @@ MACRO_ENSURE_OUT_OF_SOURCE_BUILD( "We don't support building in source, please create a build folder elsewhere and remember to run git clean -xdf to remove temporary files created by CMake." ) +#Option for memory debugging +option(SUBSURFACE_ASAN_BUILD "enable memory debugging of Subsurface binary" OFF) + #Option for profiling option(SUBSURFACE_PROFILING_BUILD "enable profiling of Subsurface binary" OFF) @@ -110,6 +113,11 @@ if (SUBSURFACE_PROFILING_BUILD) SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg") SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -pg") endif() +# set up ASan +if (SUBSURFACE_ASAN_BUILD) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address") + SET(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address") +endif() # every compiler understands -Wall set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") |