3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-23 04:43:42 +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") option(UBSAN OFF "Compile library and executables with LLVM Undefined Behavior Sanitizer")
if(ASAN) if(ASAN)
if(NOT TARGET asan)
find_package(sanitizer REQUIRED "asan") find_package(sanitizer REQUIRED "asan")
endif()
target_link_libraries(app4triqs_c PUBLIC asan) target_link_libraries(app4triqs_c PUBLIC asan)
install(TARGETS asan EXPORT app4triqs-targets) install(TARGETS asan EXPORT app4triqs-targets)
endif() endif()
if(UBSAN) if(UBSAN)
if(NOT TARGET ubsan)
find_package(sanitizer REQUIRED "ubsan") find_package(sanitizer REQUIRED "ubsan")
endif()
target_link_libraries(app4triqs_c PUBLIC ubsan) target_link_libraries(app4triqs_c PUBLIC ubsan)
install(TARGETS ubsan EXPORT app4triqs-targets) install(TARGETS ubsan EXPORT app4triqs-targets)
endif() endif()