summaryrefslogtreecommitdiffstats
path: root/Modules/FindLibXml2.cmake
diff options
context:
space:
mode:
authorKai Pastor <dg0yt@darc.de>2024-08-07 18:11:41 (GMT)
committerKai Pastor <dg0yt@darc.de>2024-08-07 18:11:43 (GMT)
commit25b947589a165a4bba486842dd11bfb3217b146e (patch)
tree54a33fc4700e21206c745368baae24230dbfde4c /Modules/FindLibXml2.cmake
parentaa6b2180bf9926e62641871908ae059c19ddb3a3 (diff)
downloadCMake-25b947589a165a4bba486842dd11bfb3217b146e.zip
CMake-25b947589a165a4bba486842dd11bfb3217b146e.tar.gz
CMake-25b947589a165a4bba486842dd11bfb3217b146e.tar.bz2
Modules: Guard calls to pkg_check_modules
Before calling pkg_check_modules, modules must check PKG_CONFIG_FOUND. When FindPkgConfig.cmake is loaded, pkg_check_modules is always defined regardless of pkg-config being present. However, the whole module might be disabled on user request with CMAKE_DISABLE_FIND_PACKAGE_PkgConfig. This must not break Find modules which just look for a hint or similar.
Diffstat (limited to 'Modules/FindLibXml2.cmake')
-rw-r--r--Modules/FindLibXml2.cmake4
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/FindLibXml2.cmake b/Modules/FindLibXml2.cmake
index 1c5f9be..cc2d630 100644
--- a/Modules/FindLibXml2.cmake
+++ b/Modules/FindLibXml2.cmake
@@ -58,7 +58,9 @@ cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
# use pkg-config to get the directories and then use these values
# in the find_path() and find_library() calls
find_package(PkgConfig QUIET)
-PKG_CHECK_MODULES(PC_LIBXML QUIET libxml-2.0)
+if(PKG_CONFIG_FOUND)
+ PKG_CHECK_MODULES(PC_LIBXML QUIET libxml-2.0)
+endif()
find_path(LIBXML2_INCLUDE_DIR NAMES libxml/xpath.h
HINTS