FindLibXslt¶
Finds the XSL Transformations, Extensible Stylesheet Language Transformations (XSLT) library (libxslt):
find_package(LibXslt [<version>] [...])
Imported Targets¶
在 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.
結果變數¶
該模組定義了以下變數:
LibXslt_FOUND在 3.3 版被加入.
Boolean indicating whether (the requested version of) libxslt was found.
LibXslt_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.
快取變數¶
The following cache variables may also be set:
LIBXSLT_INCLUDE_DIRDirectory containing
libxslt/xslt.hand other libxslt header files.LIBXSLT_EXSLT_INCLUDE_DIR在 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.
已棄用的變數¶
The following variables are provided for backward compatibility:
LIBXSLT_FOUND在 4.2 版之後被棄用: Use
LibXslt_FOUND, which has the same value.Boolean indicating whether (the requested version of) libxslt was found.
LIBXSLT_VERSION_STRING在 4.2 版之後被棄用: Superseded by the
LibXslt_VERSION.The version of libxslt found.
範例¶
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()