summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cmake/FindAtomic.cmake7
-rw-r--r--cmake/FindWrapDoubleConversion.cmake7
-rw-r--r--cmake/FindWrapRt.cmake7
3 files changed, 21 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>
diff --git a/cmake/FindWrapDoubleConversion.cmake b/cmake/FindWrapDoubleConversion.cmake
index 1164f6ba44..9c804a3eec 100644
--- a/cmake/FindWrapDoubleConversion.cmake
+++ b/cmake/FindWrapDoubleConversion.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 WrapDoubleConversion::WrapDoubleConversion)
+ set(WrapDoubleConversion_FOUND ON)
+ return()
+endif()
+
add_library(WrapDoubleConversion::WrapDoubleConversion INTERFACE IMPORTED)
find_package(double-conversion)
diff --git a/cmake/FindWrapRt.cmake b/cmake/FindWrapRt.cmake
index ef5475c53d..d14b922062 100644
--- a/cmake/FindWrapRt.cmake
+++ b/cmake/FindWrapRt.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 WrapRt)
+ set(WrapRt_FOUND ON)
+ return()
+endif()
+
include(CheckCXXSourceCompiles)
include(CMakePushCheckState)