From 2680025c1b8ac51812931d78b2e0a4777f8e1774 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Wed, 25 Aug 2021 11:14:30 +0200 Subject: cmake: Add check for libatomic linking requirement Some archs require linking against libatomic, others don't. We add some CMake code that checks for libatomic.so requirement if: - We are not on MSVC, AND - Compiling std::atomics code would cause a linker error. We then check for the existence of libatomic.so, and fail if we can't find it. --- host/lib/utils/CMakeLists.txt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'host/lib/utils') diff --git a/host/lib/utils/CMakeLists.txt b/host/lib/utils/CMakeLists.txt index 0d18945ca..639b3e94e 100644 --- a/host/lib/utils/CMakeLists.txt +++ b/host/lib/utils/CMakeLists.txt @@ -177,6 +177,21 @@ set_source_files_properties( PROPERTIES COMPILE_DEFINITIONS "${LOAD_MODULES_DEFS}" ) +######################################################################## +# Check if we dynamically need to link against libatomic +# "Guerney, deploy the family atomics!" +######################################################################## +message(STATUS "") +message(STATUS "Configuring atomics support...") +include(UHDAtomics) +CHECK_ATOMICS_LIB_REQUIRED(NEED_LIBATOMIC) +if(NEED_LIBATOMIC) + message(STATUS " Atomics support is provided by separate libatomic.") + LIBUHD_APPEND_LIBS("atomic") +else() + message(STATUS " Atomics support is built-in, no linking required.") +endif() + ######################################################################## # Define UHD_PKG_DATA_PATH for paths.cpp ######################################################################## -- cgit v1.2.3