mudlet/cmake/FindPUGIXML.cmake
Stephen Lyons 68aa3e63cf
Infrastructure: update edbee-lib submodule & use system oniguruma if present (#9156)
#### Brief overview of PR changes/additions
With edbee-lib being revised to use a system oniguruma library instead
of compiling it from bundled source code (a change suggested by myself)
update our build processes to install the required dependency in order
for the CMake build process to make use of this change.

#### Motivation for adding to Mudlet
To make edbee-lib, and thus Mudlet, use a system provided library if it
is available rather than building it from source. This should decrease
the time to compile the application a little and to improve the
situation for packagers of the Mudlet application.

#### Other info (issues closed, discussion etc)
The change required a `FindONIGURUMA.cmake` file and I created one from
our `FindPUGIXML.cmake` file to suggest upstream to the `edbee-lib`
project, so that it could use the file when its license is MIT whereas
the Mudlet one is GPU 2.0 or later and not compatible in that direction
I have negotiated with our creators of the latter file to release it
with a public domain (a.k.a. Creative Commons Zero) waiver and I have
added suitable header text to both files.

---------

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
2026-04-06 16:28:46 +01:00

61 lines
2.2 KiB
CMake

# FindPUGIXML.cmake by:
# Vadim Peretokin - vperetokin@gmail.com 2018, 2020
# Florian Scheel - keneanung@googlemail.com 2019
# Stephen Lyons - slysven@virginmedia.com 2020
#
# To the extent possible under law, the person(s) above who associated CC0
# with this file have waived all copyright and related or neighboring rights
# to it.
#
# You should have received a copy of the CC0 legalcode along with this
# work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
# Find the pugixml XML parsing library.
#
# This module exports the following targets that should be used to link against:
# PUGIXML::PUGIXML
#
# Sets the usual variables expected for find_package scripts:
#
# PUGIXML_INCLUDE_DIR - header location PUGIXML_LIBRARIES - library to link
# against PUGIXML_FOUND - true if pugixml was found.
find_package(PkgConfig)
pkg_search_module(PC_PUGIXML pugixml libpugixml)
find_path(
PUGIXML_INCLUDE_DIR pugixml.hpp
HINTS ${PUGIXML_DIR} $ENV{PUGIXML_DIR} ${PC_PUGIXML_INCLUDE_DIRS}
PATHS ${PUGIXML_HOME}/include /usr/local/include
/usr/local/include/pugixml-1.9)
find_library(
PUGIXML_LIBRARY
NAMES pugixml
HINTS ${PUGIXML_DIR} $ENV{PUGIXML_DIR} ${PC_PUGIXML_LIBRARY_DIRS}
${PC_PUGIXML_LIBRARY_DIR}
PATHS ${PUGIXML_HOME}/lib /usr/local/lib /usr/local/lib/pugixml-1.9)
if(PC_PUGIXML_pugixml_FOUND)
set(PUGIXML_VER ${PC_PUGIXML_pugixml_VERSION})
elseif(PC_PUGIXML_libpugixml_FOUND)
set(PUGIXML_VER ${PC_PUGIXML_libpugixml_VERSION})
else()
set(PUGIXML_VER ${PC_PUGIXML_VERSION})
endif()
include(FindPackageHandleStandardArgs)
# Support the REQUIRED and QUIET arguments, and set PUGIXML_FOUND if found.
find_package_handle_standard_args(PUGIXML REQUIRED_VARS PUGIXML_LIBRARY
PUGIXML_INCLUDE_DIR VERSION_VAR PUGIXML_VER)
if(PUGIXML_FOUND AND NOT TARGET PUGIXML::PUGIXML)
add_library(PUGIXML::PUGIXML UNKNOWN IMPORTED)
set_target_properties(
PUGIXML::PUGIXML
PROPERTIES IMPORTED_LOCATION "${PUGIXML_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${PUGIXML_INCLUDE_DIR}")
endif()
mark_as_advanced(PUGIXML_LIBRARY PUGIXML_INCLUDE_DIR)