From 98265bd6b743a542e448bbfdcc61c995cb69bbe6 Mon Sep 17 00:00:00 2001
From: Mattias Ellert <mattias.ellert@physics.uu.se>
Date: Thu, 20 Oct 2022 09:02:48 +0200
Subject: [PATCH] Check all sizes (8, 16, 32, 64) in <atomic> check Check
operator++ in <atomic> check Add ${ATOMIC_LIBRARY} to libXrdServer
dependencies
---
cmake/XRootDSystemCheck.cmake | 12 +++++-------
src/XrdServer.cmake | 1 +
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/cmake/XRootDSystemCheck.cmake b/cmake/XRootDSystemCheck.cmake
index 52f9ba641..8af868863 100644
--- a/cmake/XRootDSystemCheck.cmake
+++ b/cmake/XRootDSystemCheck.cmake
@@ -149,13 +149,11 @@ function(check_working_cxx_atomics varname)
#include <atomic>
#include <cstdint>
int main() {
- std::atomic<int> a1(0);
- int a1val = a1.load();
- (void)a1val;
- std::atomic<uint64_t> a2(0);
- uint64_t a2val = a2.load(std::memory_order_relaxed);
- (void)a2val;
- return 0;
+ std::atomic<uint8_t> a1;
+ std::atomic<uint16_t> a2;
+ std::atomic<uint32_t> a3;
+ std::atomic<uint64_t> a4;
+ return a1++ + a2++ + a3++ + a4++;
}
" ${varname})
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
diff --git a/src/XrdServer.cmake b/src/XrdServer.cmake
index 4006976d5..d5d2e4533 100644
--- a/src/XrdServer.cmake
+++ b/src/XrdServer.cmake
@@ -191,6 +191,7 @@ target_link_libraries(
XrdUtils
${CMAKE_DL_LIBS}
${CMAKE_THREAD_LIBS_INIT}
+ ${ATOMIC_LIBRARY}
${EXTRA_LIBS}
${SOCKET_LIBRARY} )
--
2.37.3