mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-27 20:58:47 +00:00
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>
This commit is contained in:
parent
a988e3c135
commit
0521f79fae
1 changed files with 8 additions and 0 deletions
|
@ -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")
|
||||
|
|
Loading…
Reference in a new issue