From 35d7d2754d98d299f24ccb3cb294538a58d83d5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Wed, 27 Apr 2022 13:33:58 +0200 Subject: [PATCH] Support building against system pugixml (#7119) Add a SYSTEM_PUGIXML CMake option that can be used to build the package against system-provided version of pugixml instead of the vendored one. Multiple Linux distributions have a policy against bundling libraries, and in this particular case there doesn't seem to be any justification to using the bundled library version. Fixes #7118 --- src/lib/synergy/CMakeLists.txt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/lib/synergy/CMakeLists.txt b/src/lib/synergy/CMakeLists.txt index 11f68499a..16d53a079 100644 --- a/src/lib/synergy/CMakeLists.txt +++ b/src/lib/synergy/CMakeLists.txt @@ -28,8 +28,13 @@ elseif (UNIX) file(GLOB arch_sources "unix/*.cpp") endif() -include_directories("../../../ext/pugixml/src") -list(APPEND arch_sources "../../../ext/pugixml/src/pugixml.cpp") +option(SYSTEM_PUGIXML "Use system pugixml instead of vendored one" OFF) +if (SYSTEM_PUGIXML) + find_package(pugixml REQUIRED) +else() + include_directories("../../../ext/pugixml/src") + list(APPEND arch_sources "../../../ext/pugixml/src/pugixml.cpp") +endif() list(APPEND sources ${arch_sources}) list(APPEND headers ${arch_headers}) @@ -53,3 +58,6 @@ if (UNIX) endif() endif() +if (SYSTEM_PUGIXML) + target_link_libraries(synlib pugixml) +endif()