mirror of
https://github.com/triqs/dft_tools
synced 2025-01-03 10:05:49 +01:00
[cmake] Clean c++/app4triqs/CMakeLists.txt after recent additions to triqs Findsanitizer.cmake
This commit is contained in:
parent
30f32f8dec
commit
df33cb6ffd
@ -59,32 +59,16 @@ endif()
|
|||||||
|
|
||||||
# ========= Dynamic Analyzer Checks ==========
|
# ========= Dynamic Analyzer Checks ==========
|
||||||
|
|
||||||
set(sanitizers "")
|
|
||||||
# Address Sanitizer
|
|
||||||
option(ASAN OFF "Compile library and executables with LLVM Address Sanitizer")
|
option(ASAN OFF "Compile library and executables with LLVM Address Sanitizer")
|
||||||
if(ASAN)
|
|
||||||
list(APPEND sanitizers asan)
|
|
||||||
target_compile_options(app4triqs_c PRIVATE -fsanitize=address -fno-omit-frame-pointer -ggdb3)
|
|
||||||
target_link_libraries(app4triqs_c INTERFACE "-fsanitize=address -fno-omit-frame-pointer")
|
|
||||||
if(NOT DEFINED ENV{ASAN_OPTIONS})
|
|
||||||
message(WARNING "ASAN_OPTIONS is not set. Consider setting ASAN_OPTIONS=symbolize=1:detect_leaks=0 when running tests")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Undefined Behavior 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(UBSAN)
|
|
||||||
list(APPEND sanitizers ubsan)
|
|
||||||
target_compile_options(app4triqs_c PUBLIC -fsanitize=undefined -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow -fno-omit-frame-pointer -ggdb3)
|
|
||||||
target_link_libraries(app4triqs_c INTERFACE "-fsanitize=undefined -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow -fno-omit-frame-pointer")
|
|
||||||
if(NOT DEFINED ENV{UBSAN_OPTIONS})
|
|
||||||
message(WARNING "UBSAN_OPTIONS is not set. Consider setting UBSAN_OPTIONS=symbolize=1:print_stacktrace=1:halt_on_error=1 when running tests")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(sanitizers)
|
if(ASAN)
|
||||||
find_package(sanitizer REQUIRED ${sanitizers})
|
find_package(sanitizer REQUIRED "asan")
|
||||||
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
|
target_link_libraries(app4triqs_c PUBLIC asan)
|
||||||
target_link_libraries(app4triqs_c INTERFACE "-fuse-ld=gold")
|
install(TARGETS asan EXPORT app4triqs-targets)
|
||||||
endif()
|
endif()
|
||||||
|
if(UBSAN)
|
||||||
|
find_package(sanitizer REQUIRED "ubsan")
|
||||||
|
target_link_libraries(app4triqs_c PUBLIC ubsan)
|
||||||
|
install(TARGETS ubsan EXPORT app4triqs-targets)
|
||||||
endif()
|
endif()
|
||||||
|
Loading…
Reference in New Issue
Block a user