aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2020-12-22 08:15:11 -0800
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2020-12-22 08:15:11 -0800
commit06868c8f57cd904a20fcd13f0596f0b6690f2bc1 (patch)
treee55b03e893c5204712655b5abe5b0525a3df415b /scripts
parent0e3f1699ffab5f820060fe99c61f0f9495c0c5b6 (diff)
downloadpugixml-06868c8f57cd904a20fcd13f0596f0b6690f2bc1.zip
pugixml-06868c8f57cd904a20fcd13f0596f0b6690f2bc1.tar.gz
pugixml-06868c8f57cd904a20fcd13f0596f0b6690f2bc1.tar.bz2
Don't define pugixml import target if it already exists
This fixes duplicate target definition errors when find_package(pugixml) is called twice in a build. Fixes #393.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/pugixml-config.cmake.in2
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/pugixml-config.cmake.in b/scripts/pugixml-config.cmake.in
index d9db814..d4282f9 100644
--- a/scripts/pugixml-config.cmake.in
+++ b/scripts/pugixml-config.cmake.in
@@ -5,7 +5,7 @@ include("${CMAKE_CURRENT_LIST_DIR}/pugixml-targets.cmake")
# If the user is not requiring 1.11 (either by explicitly requesting an older
# version or not requesting one at all), provide the old imported target name
# for compatibility.
-if (NOT DEFINED PACKAGE_FIND_VERSION OR PACKAGE_FIND_VERSION VERSION_LESS "1.11")
+if (NOT TARGET pugixml AND (NOT DEFINED PACKAGE_FIND_VERSION OR PACKAGE_FIND_VERSION VERSION_LESS "1.11"))
add_library(pugixml INTERFACE IMPORTED)
# Equivalent to target_link_libraries INTERFACE, but compatible with CMake 3.10
set_target_properties(pugixml PROPERTIES INTERFACE_LINK_LIBRARIES pugixml::pugixml)