From 2f2efb0b2191c27fccebf5b8e4c931cb55d4d199 Mon Sep 17 00:00:00 2001 From: Alexander Bushnev Date: Tue, 17 Dec 2024 10:33:34 +0100 Subject: [PATCH] Fix ASAN build and enable it for examples (#828) * Fix ASAN build * Enable ASAN for examples --- CMakeLists.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 25b62fb53..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 !MSVC) +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)