summaryrefslogtreecommitdiffstats
path: root/Modules/FindLibXml2.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-08-02 14:35:07 (GMT)
committerBrad King <brad.king@kitware.com>2017-08-02 14:35:07 (GMT)
commitd1a7756547a26c3ec0cfba84f138066aef5bc0aa (patch)
treeb34f0d84e8498cb44fd799e6b40e6457be1b50f5 /Modules/FindLibXml2.cmake
parenta1b3886556c0c052983fc2c9299f121c04a56b93 (diff)
downloadCMake-d1a7756547a26c3ec0cfba84f138066aef5bc0aa.zip
CMake-d1a7756547a26c3ec0cfba84f138066aef5bc0aa.tar.gz
CMake-d1a7756547a26c3ec0cfba84f138066aef5bc0aa.tar.bz2
FindLibXml2: Restore compatibility with projects setting LIBXML2_LIBRARIES
In commit a1b38865 (FindLibXml2: Switch to standard module variable names, 2017-07-11) the cache variable used to store the find_library result was renamed. This breaks projects that set the old variable name explicitly. Fix compatibility with such projects by using the old variable as a default if it is set and the new one is not.
Diffstat (limited to 'Modules/FindLibXml2.cmake')
-rw-r--r--Modules/FindLibXml2.cmake7
1 files changed, 7 insertions, 0 deletions
diff --git a/Modules/FindLibXml2.cmake b/Modules/FindLibXml2.cmake
index f68628d..8ac2980 100644
--- a/Modules/FindLibXml2.cmake
+++ b/Modules/FindLibXml2.cmake
@@ -50,6 +50,13 @@ find_path(LIBXML2_INCLUDE_DIR NAMES libxml/xpath.h
PATH_SUFFIXES libxml2
)
+# CMake 3.9 and below used 'LIBXML2_LIBRARIES' as the name of
+# the cache entry storing the find_library result. Use the
+# value if it was set by the project or user.
+if(DEFINED LIBXML2_LIBRARIES AND NOT DEFINED LIBXML2_LIBRARY)
+ set(LIBXML2_LIBRARY ${LIBXML2_LIBRARIES})
+endif()
+
find_library(LIBXML2_LIBRARY NAMES xml2 libxml2
HINTS
${PC_LIBXML_LIBDIR}