mirror of
https://github.com/meganz/MEGAcmd
synced 2025-08-31 05:45:11 +00:00
Add ENABLE_{ASAN,UBSAN} flags.
This commit is contained in:
@@ -19,6 +19,10 @@ set (USE_PCRE 1 CACHE STRING "Provides pattern matching functionality for sync r
|
||||
set (HAVE_FFMPEG 1 CACHE STRING "Used to create previews/thumbnails for video files")
|
||||
set (USE_FFMPEG 1 CACHE STRING "Used to create previews/thumbnails for video files")
|
||||
|
||||
# Flags for enabling runtime checks
|
||||
option (ENABLE_ASAN "Build megaCMD with AddressSanitizer" OFF)
|
||||
option (ENABLE_UBSAN "Build megaCMD with UndefinedBehaviorSanitizer" OFF)
|
||||
|
||||
if(WIN32)
|
||||
add_definitions( -DUNICODE -D_UNICODE ) # needed for visual studio projects to use the unicode runtime libraries
|
||||
|
||||
@@ -48,6 +52,15 @@ if (NOT CMAKE_BUILD_TYPE EQUAL "Debug")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNDEBUG")
|
||||
endif ()
|
||||
|
||||
if (ENABLE_ASAN)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer -fno-common")
|
||||
endif()
|
||||
|
||||
if (ENABLE_UBSAN)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined")
|
||||
endif()
|
||||
|
||||
|
||||
set(ProjectDir "${CMAKE_CURRENT_LIST_DIR}/../..")
|
||||
|
||||
set (ENABLE_BACKUP 1 CACHE STRING "")
|
||||
|
Reference in New Issue
Block a user