about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--cmake/config.cmake.in9
1 files changed, 6 insertions, 3 deletions
diff --git a/cmake/config.cmake.in b/cmake/config.cmake.in
index 2dd9201977c0..295501e569b9 100644
--- a/cmake/config.cmake.in
+++ b/cmake/config.cmake.in
@@ -38,7 +38,10 @@ foreach (_target
          type_expr)
     set(scoped_name "googleapis-c++::${_target}_protos")
     set(imported_name "googleapis_cpp_${_target}_protos")
-    add_library(${scoped_name} IMPORTED INTERFACE)
-    set_target_properties(${scoped_name}
-                          PROPERTIES INTERFACE_LINK_LIBRARIES ${imported_name})
+    if (NOT TARGET ${scoped_name})
+        add_library(${scoped_name} IMPORTED INTERFACE)
+        set_target_properties(${scoped_name}
+                              PROPERTIES INTERFACE_LINK_LIBRARIES
+                              ${imported_name})
+    endif ()
 endforeach ()