FindLibXslt¶
Finds the XSL Transformations, Extensible Stylesheet Language Transformations (XSLT) library (libxslt):
find_package(LibXslt [<version>] [...])
Imported Targets¶
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 thexsltprocexecutable is found.
Result Variables¶
This module defines the following variables:
LibXslt_FOUNDAdded in version 3.3.
Boolean indicating whether (the requested version of) libxslt was found.
LibXslt_VERSIONAdded in version 4.2.
The version of libxslt found.
LIBXSLT_LIBRARIESLibraries needed to link to libxslt.
LIBXSLT_DEFINITIONSCompiler switches required for using libxslt.
LIBXSLT_EXSLT_LIBRARIESLibraries needed when linking against the exslt library. These are available and needed only when using exslt library.
Cache Variables¶
The following cache variables may also be set:
LIBXSLT_INCLUDE_DIRDirectory containing
libxslt/xslt.hand other libxslt header files.LIBXSLT_EXSLT_INCLUDE_DIRAdded in version 3.18.
Directory containing
libexslt/exslt.hand other exslt-related headers. These are needed only when using exslt (extensions to XSLT).LIBXSLT_XSLTPROC_EXECUTABLEFull path to the XSLT processor executable
xsltprocif found. This path is optional.
Deprecated Variables¶
The following variables are provided for backward compatibility:
LIBXSLT_FOUNDDeprecated since version 4.2: Use
LibXslt_FOUND, which has the same value.Boolean indicating whether (the requested version of) libxslt was found.
LIBXSLT_VERSION_STRINGDeprecated since version 4.2: Superseded by the
LibXslt_VERSION.The version of libxslt found.
Examples¶
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()