diff --git a/libtiledbsoma/CMakeLists.txt b/libtiledbsoma/CMakeLists.txt index 528c8c67d6..d092445439 100644 --- a/libtiledbsoma/CMakeLists.txt +++ b/libtiledbsoma/CMakeLists.txt @@ -248,11 +248,11 @@ else() # See https://www.reddit.com/r/cmake/comments/17d70h6/why_arent_generator_expressions_evaluated_for/ # for this placeholder solution. set(TILEDBSOMA_SANITIZER_FLAG "") - list(APPEND TILEDBSOMA_SANITIZER_FLAG "\$: -fsanitize=address>>") - list(APPEND TILEDBSOMA_SANITIZER_FLAG "\$: -fsanitize=leak>>") - list(APPEND TILEDBSOMA_SANITIZER_FLAG "\$: -fsanitize=thread>>") - list(APPEND TILEDBSOMA_SANITIZER_FLAG "\$: -fsanitize=undefined>>") - list(APPEND TILEDBSOMA_SANITIZER_FLAG "\$: -fsanitize=memory>>") + list(APPEND TILEDBSOMA_SANITIZER_FLAG "\$:-fsanitize=address>>") + list(APPEND TILEDBSOMA_SANITIZER_FLAG "\$:-fsanitize=leak>>") + list(APPEND TILEDBSOMA_SANITIZER_FLAG "\$:-fsanitize=thread>>") + list(APPEND TILEDBSOMA_SANITIZER_FLAG "\$:-fsanitize=undefined>>") + list(APPEND TILEDBSOMA_SANITIZER_FLAG "\$:-fsanitize=memory>>") # Compiler specific additions: diff --git a/libtiledbsoma/src/CMakeLists.txt b/libtiledbsoma/src/CMakeLists.txt index 7cda33d946..3c29f4f967 100644 --- a/libtiledbsoma/src/CMakeLists.txt +++ b/libtiledbsoma/src/CMakeLists.txt @@ -9,7 +9,7 @@ set_source_files_properties( add_library(TILEDBSOMA_NANOARROW_OBJECT OBJECT ${CMAKE_CURRENT_SOURCE_DIR}/external/src/nanoarrow/nanoarrow.c ) -target_link_libraries(TILEDBSOMA_NANOARROW_OBJECT +target_link_options(TILEDBSOMA_NANOARROW_OBJECT PRIVATE ${TILEDBSOMA_SANITIZER_FLAG} ) @@ -65,7 +65,7 @@ target_compile_options(TILEDB_SOMA_OBJECTS ${TILEDBSOMA_WERROR_OPTION} ${TILEDBSOMA_SANITIZER_FLAG} ) -target_link_libraries(TILEDB_SOMA_OBJECTS +target_link_options(TILEDB_SOMA_OBJECTS PRIVATE ${TILEDBSOMA_SANITIZER_FLAG} ) @@ -121,6 +121,8 @@ else() PUBLIC TileDB::tiledb_shared spdlog::spdlog + ) + target_link_options(tiledbsoma PRIVATE ${TILEDBSOMA_SANITIZER_FLAG} ) @@ -257,6 +259,8 @@ if(TILEDBSOMA_BUILD_CLI) # spdlog::spdlog tiledbsoma TileDB::tiledb_shared + ) + target_link_options(tiledbsoma-cli PRIVATE ${TILEDBSOMA_SANITIZER_FLAG} ) diff --git a/libtiledbsoma/test/CMakeLists.txt b/libtiledbsoma/test/CMakeLists.txt index 5baf2d54b6..73aa8949ab 100644 --- a/libtiledbsoma/test/CMakeLists.txt +++ b/libtiledbsoma/test/CMakeLists.txt @@ -37,10 +37,13 @@ add_executable(unit_soma target_link_libraries(unit_soma PRIVATE - ${TILEDBSOMA_SANITIZER_FLAG} Catch2::Catch2WithMain TileDB::tiledb_shared ) +target_link_options(unit_soma + PRIVATE + ${TILEDBSOMA_SANITIZER_FLAG} +) target_include_directories(unit_soma PRIVATE