Skip to content
Snippets Groups Projects
Commit 01af3f25 authored by Maxence Naud's avatar Maxence Naud
Browse files

Merge branch 'feat/support_ASAN' into 'dev'

feat/support_ASAN

See merge request !44
parents 07d50e6a ae2fb6c7
No related branches found
No related tags found
2 merge requests!50version 0.2.0,!44feat/support_ASAN
Pipeline #42579 passed
......@@ -11,6 +11,7 @@ message(STATUS "Project version: ${version}")
set(module_name _${project}) # target name
project(${project})
set(CXX_STANDARD 14)
##############################################
# Define options
......@@ -18,6 +19,7 @@ option(PYBIND "python binding" ON)
option(WERROR "Warning as error" OFF)
option(TEST "Enable tests" ON)
option(COVERAGE "Enable coverage" OFF)
option(ENABLE_ASAN "Enable ASan (AddressSanitizer) for runtime analysis of memory use (over/underflow, memory leak, ...)" OFF)
##############################################
# Import utils CMakeLists
......@@ -34,7 +36,6 @@ find_package(aidge_core REQUIRED)
##############################################
# Create target and set properties
file(GLOB_RECURSE src_files "src/*.cpp")
file(GLOB_RECURSE inc_files "include/*.hpp")
......@@ -43,9 +44,23 @@ target_link_libraries(${module_name}
PUBLIC
_aidge_core # _ is added because we link the target not the project
)
#Set target properties
set_property(TARGET ${module_name} PROPERTY POSITION_INDEPENDENT_CODE ON)
if( ${ENABLE_ASAN} )
message("Building ${module_name} with ASAN.")
set(SANITIZE_FLAGS -fsanitize=address -fno-omit-frame-pointer)
target_link_libraries(${module_name}
PUBLIC
-fsanitize=address
)
target_compile_options(${module_name}
PRIVATE
${SANITIZE_FLAGS}
)
endif()
target_include_directories(${module_name}
PUBLIC
$<INSTALL_INTERFACE:include>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment