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
This commit is contained in:
Michał Górny 2022-04-27 13:33:58 +02:00 committed by GitHub
parent 9b387ad1b4
commit 35d7d2754d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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()