FindLibXslt¶
Finds the XSL Transformations, Extensible Stylesheet Language Transformations (XSLT) library (libxslt).
Imported Targets¶
Added in version 3.18.
This module provides the following Imported Targets:
LibXslt::LibXslt
Target encapsulating the usage requirements of the libxslt library. This target is available only if libxslt is found.
LibXslt::LibExslt
Target 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::xsltproc
Target 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 thexsltproc
executable is found.
Result Variables¶
This module sets the following variables:
LibXslt_FOUND
Boolean indicating whether the libxslt is found. For backward compatibility, the
LIBXSLT_FOUND
variable is also set to the same value.LIBXSLT_LIBRARIES
Libraries needed to link to libxslt.
LIBXSLT_DEFINITIONS
Compiler switches required for using libxslt.
LIBXSLT_VERSION_STRING
Version of libxslt found.
LIBXSLT_EXSLT_LIBRARIES
Libraries 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_DIR
Directory containing
libxslt/xslt.h
and other libxslt header files.LIBXSLT_EXSLT_INCLUDE_DIR
Added 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_EXECUTABLE
Full path to the XSLT processor executable
xsltproc
if found. This path is optional.
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()