Finds the XSL Transformations, Extensible Stylesheet Language Transformations (XSLT) library (libxslt).
Added in version 3.18.
This module provides the following Imported Targets:
LibXslt::LibXsltTarget encapsulating the usage requirements of the libxslt library. This target is available only if libxslt is found.
LibXslt::LibExsltTarget encapsulating the usage requirements for the libexslt library. Part of the libxslt package, libexslt provides optional extensions to XSLT on top of libxslt. This target is available only if the main libxslt library is found.
LibXslt::xsltprocTarget encapsulating the command-line XSLT processor (xsltproc). This
tool, part of the libxslt package, applies XSLT stylesheets to XML documents
as a command-line alternative to the libxslt library. This target is
available only if the xsltproc executable is found.
This module sets the following variables:
LibXslt_FOUNDBoolean indicating whether the libxslt is found. For backward compatibility,
the LIBXSLT_FOUND variable is also set to the same value.
LIBXSLT_LIBRARIESLibraries needed to link to libxslt.
LIBXSLT_DEFINITIONSCompiler switches required for using libxslt.
LIBXSLT_VERSION_STRINGVersion of libxslt found.
LIBXSLT_EXSLT_LIBRARIESLibraries needed when linking against the exslt library. These are available and needed only when using exslt library.
The following cache variables may also be set:
LIBXSLT_INCLUDE_DIRDirectory containing libxslt/xslt.h and other libxslt header files.
LIBXSLT_EXSLT_INCLUDE_DIRAdded in version 3.18.
Directory containing libexslt/exslt.h and other exslt-related headers.
These are needed only when using exslt (extensions to XSLT).
LIBXSLT_XSLTPROC_EXECUTABLEFull path to the XSLT processor executable xsltproc if found. This path
is optional.
Finding libxslt library and linking it to a project target:
find_package(LibXslt)
target_link_libraries(foo PRIVATE LibXslt::LibXslt)
When project also needs the extensions to XSLT (exslt) library, both targets should be linked:
find_package(LibXslt)
target_link_libraries(foo PRIVATE LibXslt::LibXslt LibXslt::LibExslt)
Example, how to use XSLT processor in a custom command build rule:
find_package(LibXslt)
if(TARGET LibXslt::xsltproc)
# Executed when some build rule depends on example.html.
add_custom_command(
OUTPUT example.html
COMMAND LibXslt::xsltproc -o example.html transform.xslt example.xml
)
endif()