1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

feat(build): add option to enable AddressSanitizer

This commit is contained in:
sudden6 2018-08-25 00:48:53 +02:00
parent a2c44cbeda
commit fd99dfd0a5
No known key found for this signature in database
GPG Key ID: 279509B499E032B9

View File

@ -13,11 +13,17 @@ option(USE_FILTERAUDIO "Enable the echo canceling backend" ON)
option(AUTOUPDATE "Enable the auto updater" OFF) option(AUTOUPDATE "Enable the auto updater" OFF)
option(USE_CCACHE "Use ccache when available" ON) option(USE_CCACHE "Use ccache when available" ON)
option(SPELL_CHECK "Enable spell cheching support" ON) option(SPELL_CHECK "Enable spell cheching support" ON)
option(ASAN "Compile with AddressSanitizer" OFF)
if(NOT CMAKE_BUILD_TYPE) if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Options are: None, Debug, Release, RelWithDebInfo, MinSizeRel." FORCE) set(CMAKE_BUILD_TYPE Debug CACHE STRING "Options are: None, Debug, Release, RelWithDebInfo, MinSizeRel." FORCE)
endif() endif()
if(ASAN)
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
set (CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
endif()
set(ENV{PKG_CONFIG_PATH} set(ENV{PKG_CONFIG_PATH}
${CMAKE_SOURCE_DIR}/libs/lib/pkgconfig:/opt/ffmpeg/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}) ${CMAKE_SOURCE_DIR}/libs/lib/pkgconfig:/opt/ffmpeg/lib/pkgconfig:$ENV{PKG_CONFIG_PATH})