--- tiledb/CMakeLists.txt.orig	2023-12-14 04:43:06.000000000 +0800
+++ tiledb/CMakeLists.txt	2024-01-28 17:30:15.000000000 +0800
@@ -659,6 +659,7 @@
     ZLIB::ZLIB
     ${ZSTD_TARGET}
     libmagic
+    MacportsLegacySupport
 )
 
 if(TILEDB_WEBP)
@@ -670,6 +671,13 @@
   add_definitions(-DTILEDB_WEBP)
 endif()
 
+if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+  target_link_libraries(TILEDB_CORE_OBJECTS_ILIB
+    INTERFACE
+    atomic
+  )
+endif()
+
 if (NOT WIN32)
   target_link_libraries(TILEDB_CORE_OBJECTS_ILIB
     INTERFACE

--- test/CMakeLists.txt.orig	2023-04-26 09:28:54.000000000 +0800
+++ test/CMakeLists.txt	2023-05-22 15:10:49.000000000 +0800
@@ -295,6 +295,7 @@
     TILEDB_CORE_OBJECTS_ILIB
     Catch2::Catch2
     tiledb_test_support_lib
     configuration_definitions
+    MacportsLegacySupport
 )
 
 target_link_libraries(tiledb_unit PRIVATE $<BUILD_INTERFACE:common>)
