From 8a90ef5a4400ccb5bfe1f867e25dde2254996df7 Mon Sep 17 00:00:00 2001 From: Markus Rickert Date: Thu, 23 Apr 2020 15:19:30 +0200 Subject: FindLibXslt: use LIBXSLT_LIBRARY as cache variable Use LIBXSLT_LIBRARY as cache variable instead of LIBXSLT_LIBRARIES to adhere to documented conventions. Check for defined LIBXSLT_LIBRARIES value to support backwards compatibility. --- Modules/FindLibXslt.cmake | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Modules/FindLibXslt.cmake b/Modules/FindLibXslt.cmake index 9bc855f..fc7adeb 100644 --- a/Modules/FindLibXslt.cmake +++ b/Modules/FindLibXslt.cmake @@ -54,7 +54,14 @@ find_path(LIBXSLT_INCLUDE_DIR NAMES libxslt/xslt.h ${PC_LIBXSLT_INCLUDE_DIRS} ) -find_library(LIBXSLT_LIBRARIES NAMES xslt libxslt +# CMake 3.17 and below used 'LIBXSLT_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 LIBXSLT_LIBRARIES AND NOT DEFINED LIBXSLT_LIBRARY) + set(LIBXSLT_LIBRARY ${LIBXSLT_LIBRARIES}) +endif() + +find_library(LIBXSLT_LIBRARY NAMES xslt libxslt HINTS ${PC_LIBXSLT_LIBDIR} ${PC_LIBXSLT_LIBRARY_DIRS} @@ -108,7 +115,7 @@ if(LIBXSLT_FOUND AND NOT TARGET LibXslt::LibXslt) add_library(LibXslt::LibXslt UNKNOWN IMPORTED) set_target_properties(LibXslt::LibXslt PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${LIBXSLT_INCLUDE_DIR}") set_target_properties(LibXslt::LibXslt PROPERTIES INTERFACE_COMPILE_OPTIONS "${LIBXSLT_DEFINITIONS}") - set_property(TARGET LibXslt::LibXslt APPEND PROPERTY IMPORTED_LOCATION "${LIBXSLT_LIBRARIES}") + set_property(TARGET LibXslt::LibXslt APPEND PROPERTY IMPORTED_LOCATION "${LIBXSLT_LIBRARY}") endif() if(LIBXSLT_FOUND AND NOT TARGET LibXslt::LibExslt) -- cgit v0.12