Add address sanitizer build type
This commit is contained in:
parent
25cf3a8585
commit
8c58a7a6ab
@ -34,6 +34,11 @@ if(ENABLE_DEBUG_LOG)
|
|||||||
add_definitions(-DENABLE_DEBUG)
|
add_definitions(-DENABLE_DEBUG)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(NOT CMAKE_BUILD_TYPE)
|
||||||
|
set(CMAKE_BUILD_TYPE "Release" CACHE STRING
|
||||||
|
"Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel or Asan." FORCE)
|
||||||
|
endif(NOT CMAKE_BUILD_TYPE)
|
||||||
|
|
||||||
include(CheckIPOSupported)
|
include(CheckIPOSupported)
|
||||||
check_ipo_supported(RESULT ipo_available OUTPUT error LANGUAGES C)
|
check_ipo_supported(RESULT ipo_available OUTPUT error LANGUAGES C)
|
||||||
|
|
||||||
@ -52,6 +57,14 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Extra build type for AddressSanitizer (Asan)
|
||||||
|
set(CMAKE_C_FLAGS_ASAN "${CMAKE_C_FLAGS_DEBUG} \
|
||||||
|
-fsanitize=address \
|
||||||
|
-fno-optimize-sibling-calls \
|
||||||
|
-fsanitize-address-use-after-scope \
|
||||||
|
-fno-omit-frame-pointer"
|
||||||
|
CACHE STRING "Flags used by the C compiler during AddressSanitizer builds." FORCE)
|
||||||
|
|
||||||
add_library(ovni SHARED
|
add_library(ovni SHARED
|
||||||
ovni.c
|
ovni.c
|
||||||
parson.c
|
parson.c
|
||||||
|
Loading…
Reference in New Issue
Block a user