3
0
mirror of https://github.com/triqs/dft_tools synced 2024-11-18 12:03:50 +01:00

[cmake] Find libasan and libubsan only if the targets are not already defined by the parent project

This commit is contained in:
Nils Wentzell 2019-11-18 14:04:29 -05:00
parent 64bbc3ce48
commit 919639bd27

View File

@ -63,12 +63,16 @@ option(ASAN OFF "Compile library and executables with LLVM Address Sanitizer")
option(UBSAN OFF "Compile library and executables with LLVM Undefined Behavior Sanitizer")
if(ASAN)
find_package(sanitizer REQUIRED "asan")
if(NOT TARGET asan)
find_package(sanitizer REQUIRED "asan")
endif()
target_link_libraries(app4triqs_c PUBLIC asan)
install(TARGETS asan EXPORT app4triqs-targets)
endif()
if(UBSAN)
find_package(sanitizer REQUIRED "ubsan")
if(NOT TARGET ubsan)
find_package(sanitizer REQUIRED "ubsan")
endif()
target_link_libraries(app4triqs_c PUBLIC ubsan)
install(TARGETS ubsan EXPORT app4triqs-targets)
endif()