From e1743a37c0dfc3d8f2cccb357490956ef20fbd11 Mon Sep 17 00:00:00 2001 From: Alexander Bushnev Date: Mon, 16 Dec 2024 17:23:48 +0100 Subject: [PATCH 1/2] Fix ASAN build --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 25b62fb53..b55b10746 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -469,7 +469,7 @@ if(BUILD_EXAMPLES) add_subdirectory(examples) endif() -if(ASAN AND !MSVC) +if(ASAN AND NOT MSVC) add_compile_options(-fsanitize=address) add_link_options(-fsanitize=address) endif() From 17d2530c50c97d2f4f3648ad60b3bffbb61504dc Mon Sep 17 00:00:00 2001 From: Alexander Bushnev Date: Mon, 16 Dec 2024 20:08:22 +0100 Subject: [PATCH 2/2] Enable ASAN for examples --- CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b55b10746..1295f5a5d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -465,15 +465,15 @@ if(UNIX) install(FILES "${CMAKE_SOURCE_DIR}/zenohpico.pc" CONFIGURATIONS Release RelWithDebInfo DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig" COMPONENT Dev) endif() -if(BUILD_EXAMPLES) - add_subdirectory(examples) -endif() - if(ASAN AND NOT MSVC) add_compile_options(-fsanitize=address) add_link_options(-fsanitize=address) endif() +if(BUILD_EXAMPLES) + add_subdirectory(examples) +endif() + if(UNIX OR MSVC) if(BUILD_TOOLS) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/tools)