summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Ranostay <matt.ranostay@konsulko.com>2020-01-23 19:43:15 -0800
committerMatt Ranostay <matt.ranostay@konsulko.com>2020-01-28 01:11:15 +0000
commit48f409c1d6d9a8420db08eb8ece764999aeeec48 (patch)
tree5a123b2e1e32abfe636662f7181ab00e5fe9a565
parent959b151461e5c83927b1aaca0d43ebdf9153b739 (diff)
build-options: add SANITIZERS build typehalibut_8.0.6halibut/8.0.68.0.6halibut
Add SANITIZERS build type for using AddressSanitizers to find various memory corruptions within applications. Bug-AGL: SPEC-3040 Change-Id: If430177cbac452c09d710a885cbe802419f13e6b Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
-rw-r--r--src/cmake/cmake.d/01-build_options.cmake12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/cmake/cmake.d/01-build_options.cmake b/src/cmake/cmake.d/01-build_options.cmake
index 3b1eca7..2581d6d 100644
--- a/src/cmake/cmake.d/01-build_options.cmake
+++ b/src/cmake/cmake.d/01-build_options.cmake
@@ -104,6 +104,12 @@ set(COVERAGE_COMPILE_OPTIONS
-O0
--coverage
CACHE STRING "Compilation flags for COVERAGE build type.")
+set(SANITIZERS_COMPILE_OPTIONS
+ -g
+ -O0
+ -fsanitize=address
+ -fno-omit-frame-pointer
+ CACHE STRING "Compilation flags for SANITIZERS build type.")
set(RELEASE_COMPILE_OPTIONS
-O2
-D_FORTIFY_SOURCE=2
@@ -118,6 +124,9 @@ endforeach()
foreach(option ${COVERAGE_COMPILE_OPTIONS})
add_compile_options($<$<CONFIG:COVERAGE>:${option}>)
endforeach()
+foreach(option ${SANITIZERS_COMPILE_OPTIONS})
+ add_compile_options($<$<CONFIG:SANITIZERS>:${option}>)
+endforeach()
foreach(option ${RELEASE_COMPILE_OPTIONS})
add_compile_options($<$<CONFIG:RELEASE>:${option}>)
endforeach()
@@ -144,6 +153,9 @@ ENDIF(CMAKE_BUILD_TYPE MATCHES DEBUG AND USE_EFENCE)
IF(${CMAKE_BUILD_TYPE} MATCHES COVERAGE)
list (APPEND link_libraries -coverage)
ENDIF(${CMAKE_BUILD_TYPE} MATCHES COVERAGE)
+IF(${CMAKE_BUILD_TYPE} MATCHES SANITIZERS)
+ list (APPEND link_libraries -fsanitize=address)
+ENDIF(${CMAKE_BUILD_TYPE} MATCHES SANITIZERS)
# set default include directories
INCLUDE_DIRECTORIES(${EXTRA_INCLUDE_DIRS})