Skip to content
Snippets Groups Projects

feat/support_ASAN

Merged Grégoire Kubler requested to merge (removed):feat/support_ASAN into dev
All threads resolved!
+ 15
1
@@ -18,6 +18,7 @@ option(PYBIND "python binding" ON)
@@ -18,6 +18,7 @@ option(PYBIND "python binding" ON)
option(WERROR "Warning as error" OFF)
option(WERROR "Warning as error" OFF)
option(TEST "Enable tests" ON)
option(TEST "Enable tests" ON)
option(COVERAGE "Enable coverage" OFF)
option(COVERAGE "Enable coverage" OFF)
 
option(ENABLE_ASAN "Enable ASan (adress sanitizer) for runtime analysis of memory use (over/underflow, memory leak, ...)" OFF)
##############################################
##############################################
# Import utils CMakeLists
# Import utils CMakeLists
@@ -34,7 +35,6 @@ find_package(aidge_core REQUIRED)
@@ -34,7 +35,6 @@ find_package(aidge_core REQUIRED)
##############################################
##############################################
# Create target and set properties
# Create target and set properties
file(GLOB_RECURSE src_files "src/*.cpp")
file(GLOB_RECURSE src_files "src/*.cpp")
file(GLOB_RECURSE inc_files "include/*.hpp")
file(GLOB_RECURSE inc_files "include/*.hpp")
@@ -43,9 +43,23 @@ target_link_libraries(${module_name}
@@ -43,9 +43,23 @@ target_link_libraries(${module_name}
PUBLIC
PUBLIC
_aidge_core # _ is added because we link the target not the project
_aidge_core # _ is added because we link the target not the project
)
)
 
#Set target properties
#Set target properties
set_property(TARGET ${module_name} PROPERTY POSITION_INDEPENDENT_CODE ON)
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}
target_include_directories(${module_name}
PUBLIC
PUBLIC
$<INSTALL_INTERFACE:include>
$<INSTALL_INTERFACE:include>
Loading