mirror of
https://github.com/falcosecurity/falco.git
synced 2025-07-19 17:16:53 +00:00
new(build): add option to build with ASAN and UBSAN
Signed-off-by: Luca Guerra <luca@guerra.sh>
This commit is contained in:
parent
1aae10fe84
commit
b82c73c66c
@ -21,6 +21,9 @@ option(BUILD_WARNINGS_AS_ERRORS "Enable building with -Wextra -Werror flags" OFF
|
|||||||
option(MINIMAL_BUILD "Build a minimal version of Falco, containing only the engine and basic input/output (EXPERIMENTAL)" OFF)
|
option(MINIMAL_BUILD "Build a minimal version of Falco, containing only the engine and basic input/output (EXPERIMENTAL)" OFF)
|
||||||
option(MUSL_OPTIMIZED_BUILD "Enable if you want a musl optimized build" OFF)
|
option(MUSL_OPTIMIZED_BUILD "Enable if you want a musl optimized build" OFF)
|
||||||
option(BUILD_FALCO_UNIT_TESTS "Build falco unit tests" OFF)
|
option(BUILD_FALCO_UNIT_TESTS "Build falco unit tests" OFF)
|
||||||
|
option(USE_ASAN "Build with AddressSanitizer" OFF)
|
||||||
|
option(USE_UBSAN "Build with UndefinedBehaviorSanitizer" OFF)
|
||||||
|
option(UBSAN_HALT_ON_ERROR "Halt on error when building with UBSan" ON)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
if(POLICY CMP0091)
|
if(POLICY CMP0091)
|
||||||
|
@ -53,6 +53,17 @@ if(NOT MSVC)
|
|||||||
set(FALCO_SECURITY_FLAGS "${FALCO_SECURITY_FLAGS} -D_FORTIFY_SOURCE=2")
|
set(FALCO_SECURITY_FLAGS "${FALCO_SECURITY_FLAGS} -D_FORTIFY_SOURCE=2")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(USE_ASAN)
|
||||||
|
set(FALCO_SECURITY_FLAGS "${FALCO_SECURITY_FLAGS} -fsanitize=address")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(USE_UBSAN)
|
||||||
|
set(FALCO_SECURITY_FLAGS "${FALCO_SECURITY_FLAGS} -fsanitize=undefined")
|
||||||
|
if(UBSAN_HALT_ON_ERROR)
|
||||||
|
set(FALCO_SECURITY_FLAGS "${FALCO_SECURITY_FLAGS} -fno-sanitize-recover=undefined")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
set(CMAKE_COMMON_FLAGS "${FALCO_SECURITY_FLAGS} -Wall -ggdb ${FALCO_EXTRA_FEATURE_FLAGS} ${MINIMAL_BUILD_FLAGS} ${MUSL_FLAGS}")
|
set(CMAKE_COMMON_FLAGS "${FALCO_SECURITY_FLAGS} -Wall -ggdb ${FALCO_EXTRA_FEATURE_FLAGS} ${MINIMAL_BUILD_FLAGS} ${MUSL_FLAGS}")
|
||||||
|
|
||||||
if(BUILD_WARNINGS_AS_ERRORS)
|
if(BUILD_WARNINGS_AS_ERRORS)
|
||||||
|
Loading…
Reference in New Issue
Block a user