1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-15 03:48:02 +08:00

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.
This commit is contained in:
Markus Rickert
2020-04-23 15:19:30 +02:00
parent 1aa7df4114
commit 8a90ef5a44

View File

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