aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/utils
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2021-08-25 11:14:30 +0200
committerAaron Rossetto <aaron.rossetto@ni.com>2021-08-27 15:28:20 -0500
commit2680025c1b8ac51812931d78b2e0a4777f8e1774 (patch)
tree67cb7ba42d2220fbf175ae791269e9977d454a7f /host/lib/utils
parent34b51b40f59412ae42e99246a60dd70de53ee180 (diff)
downloaduhd-2680025c1b8ac51812931d78b2e0a4777f8e1774.tar.gz
uhd-2680025c1b8ac51812931d78b2e0a4777f8e1774.tar.bz2
uhd-2680025c1b8ac51812931d78b2e0a4777f8e1774.zip
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.
Diffstat (limited to 'host/lib/utils')
-rw-r--r--host/lib/utils/CMakeLists.txt15
1 files changed, 15 insertions, 0 deletions
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
@@ -178,6 +178,21 @@ set_source_files_properties(
)
########################################################################
+# 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
########################################################################
file(TO_NATIVE_PATH "${CMAKE_INSTALL_PREFIX}" UHD_PKG_PATH)