From 6be77374803628b592b722d5335bae3e616755c6 Mon Sep 17 00:00:00 2001
From: barracuda156 <vital.had@gmail.com>
Date: Thu, 1 Feb 2024 01:37:45 +0800
Subject: [PATCH] Fix building some tests which need libatomic

---
 tiledb/api/c_api/enumeration/CMakeLists.txt               | 2 +-
 tiledb/api/c_api/string/CMakeLists.txt                    | 2 +-
 tiledb/api/c_api_support/exception_wrapper/CMakeLists.txt | 2 +-
 tiledb/common/thread_pool/test/CMakeLists.txt             | 1 +
 tiledb/sm/query/readers/aggregators/test/CMakeLists.txt   | 1 +
 5 files changed, 5 insertions(+), 3 deletions(-)

diff --git tiledb/api/c_api/enumeration/CMakeLists.txt tiledb/api/c_api/enumeration/CMakeLists.txt
index af077b988..78feda977 100644
--- tiledb/api/c_api/enumeration/CMakeLists.txt
+++ tiledb/api/c_api/enumeration/CMakeLists.txt
@@ -32,7 +32,7 @@
 
 commence(object_library capi_enumeration_stub)
   this_target_sources(enumeration_api.cc)
-  this_target_link_libraries(export)
+  this_target_link_libraries(export atomic)
   this_target_object_libraries(capi_buffer_stub capi_string constants)
   this_target_object_libraries(enumeration)
 conclude(object_library)
 
diff --git tiledb/api/c_api/string/CMakeLists.txt tiledb/api/c_api/string/CMakeLists.txt
index 3ce1872d1..e8c8b3df4 100644
--- tiledb/api/c_api/string/CMakeLists.txt
+++ tiledb/api/c_api/string/CMakeLists.txt
@@ -37,7 +37,7 @@ gather_sources(${SOURCES})
 #
 commence(object_library capi_string)
   this_target_sources(${SOURCES})
-  this_target_link_libraries(export)
+  this_target_link_libraries(export atomic)
   this_target_object_libraries(baseline capi_context_stub)
 conclude(object_library)
 
diff --git tiledb/api/c_api_support/exception_wrapper/CMakeLists.txt tiledb/api/c_api_support/exception_wrapper/CMakeLists.txt
index 7d6669f31..bef1f163c 100644
--- tiledb/api/c_api_support/exception_wrapper/CMakeLists.txt
+++ tiledb/api/c_api_support/exception_wrapper/CMakeLists.txt
@@ -40,7 +40,7 @@ gather_sources(${SOURCES})
 
 commence(object_library exception_wrapper)
   this_target_sources(${SOURCES})
-  this_target_link_libraries(export)
+  this_target_link_libraries(export atomic)
   this_target_object_libraries(baseline thread_pool config)
 conclude(object_library)
 
diff --git tiledb/common/thread_pool/test/CMakeLists.txt tiledb/common/thread_pool/test/CMakeLists.txt
index 39a7426ae..df0b8221a 100644
--- tiledb/common/thread_pool/test/CMakeLists.txt
+++ tiledb/common/thread_pool/test/CMakeLists.txt
@@ -33,4 +33,5 @@ commence(unit_test thread_pool)
     # a part of the thread pool.
     this_target_object_libraries(cancelable_tasks)
     this_target_sources(main.cc unit_thread_pool.cc)
+    this_target_link_libraries(atomic)
 conclude(unit_test)
diff --git tiledb/sm/query/readers/aggregators/test/CMakeLists.txt tiledb/sm/query/readers/aggregators/test/CMakeLists.txt
index 386fd236b..a17498fc6 100644
--- tiledb/sm/query/readers/aggregators/test/CMakeLists.txt
+++ tiledb/sm/query/readers/aggregators/test/CMakeLists.txt
@@ -29,4 +29,5 @@ include(unit_test)
 commence(unit_test aggregators)
     this_target_sources(main.cc bench_aggregators.cc unit_aggregate_with_count.cc unit_aggregation_policies.cc unit_aggregators.cc)
     this_target_object_libraries(aggregators)
+    this_target_link_libraries(atomic)
 conclude(unit_test)

--- tiledb/common/CMakeLists.txt	2024-03-22 16:59:57.000000000 +0800
+++ tiledb/common/CMakeLists.txt	2024-03-25 12:00:10.000000000 +0800
@@ -71,6 +71,7 @@
     find_package(Spdlog_EP REQUIRED)
     target_link_libraries(baseline PUBLIC spdlog::spdlog)
     target_link_libraries(baseline PUBLIC common)
+    target_link_libraries(baseline PUBLIC atomic)
 conclude(object_library)
 
 #
