summaryrefslogtreecommitdiffstats
path: root/cmake/FindAtomic.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/FindAtomic.cmake')
-rw-r--r--cmake/FindAtomic.cmake7
1 files changed, 7 insertions, 0 deletions
diff --git a/cmake/FindAtomic.cmake b/cmake/FindAtomic.cmake
index b4580067ca..91cee62046 100644
--- a/cmake/FindAtomic.cmake
+++ b/cmake/FindAtomic.cmake
@@ -1,3 +1,10 @@
+# We can't create the same interface imported target multiple times, CMake will complain if we do
+# that. This can happen if the find_package call is done in multiple different subdirectories.
+if(TARGET Atomic)
+ set(Atomic_FOUND ON)
+ return()
+endif()
+
include(CheckCXXSourceCompiles)
set (atomic_test_sources "#include <atomic>