mirror of
https://github.com/triqs/dft_tools
synced 2025-01-07 03:43:12 +01:00
f2d7e84bdd
-consistent indends in all cmake files -add static analyzer checks with both cppcheck and clang-tidy -add dynamic analyzer checks with Address Sanitizer and option ASAN -add dynamic analyzer checks with Undefined Behavior Sanitizer and option UBSAN -Further Cleaning and Comments
51 lines
1.5 KiB
CMake
51 lines
1.5 KiB
CMake
# Copyright Nils Wentzell 2018
|
|
# Distributed under the GNU GENERAL PUBLIC LICENSE Version 3.0.
|
|
# See accompanying file LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt
|
|
#
|
|
# This cmake find module looks for the LLVM Address Sanitizer Runtime Library
|
|
# It sets up : ASAN_RT_LIBRARY
|
|
|
|
# This module finds the LLVM Address Sanitizer Runtime Library
|
|
# latter case skip to the "Boost CMake" section below. For the former
|
|
#
|
|
# Use this module by invoking find_package with the form::
|
|
#
|
|
# find_package(libasan_rt [REQUIRED])
|
|
#
|
|
# Results are reported in::
|
|
#
|
|
# ASAN_RT_LIBRARY Address Sanitizer Runtime Library
|
|
|
|
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
|
|
set(name clang_rt.asan-x86_64)
|
|
elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
|
|
set(name asan)
|
|
else()
|
|
message(FATAL_ERROR "LLVM Address Sanitizer is not available for your compiler")
|
|
endif()
|
|
|
|
find_library(ASAN_RT_LIBRARY
|
|
NAMES ${name}
|
|
PATHS
|
|
ENV LIBRARY_PATH
|
|
ENV LD_INCLUDE_PATH
|
|
/usr/lib
|
|
/usr/local/lib
|
|
/usr/lib/gcc/*/*
|
|
/usr/lib/clang/*/lib/linux
|
|
/usr/lib/llvm-*/lib/clang/*/lib/linux
|
|
/usr/local/opt/llvm/lib/clang/*/lib/darwin
|
|
)
|
|
|
|
mark_as_advanced(ASAN_RT_LIBRARY)
|
|
|
|
# Imported target
|
|
add_library(libasan_rt SHARED IMPORTED)
|
|
set_property(TARGET libasan_rt PROPERTY IMPORTED_LOCATION ${ASAN_RT_LIBRARY})
|
|
|
|
include(FindPackageHandleStandardArgs)
|
|
find_package_handle_standard_args("Address Sanitizer Runtime Library"
|
|
REQUIRED_VARS ASAN_RT_LIBRARY
|
|
FAIL_MESSAGE "Address Sanitizer Runtime Libraries not found! Consider installing for additional checks!"
|
|
)
|