diff options
Diffstat (limited to 'project/cmake/modules/FindXSLT.cmake')
| -rw-r--r-- | project/cmake/modules/FindXSLT.cmake | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/project/cmake/modules/FindXSLT.cmake b/project/cmake/modules/FindXSLT.cmake new file mode 100644 index 0000000..9be51d3 --- /dev/null +++ b/project/cmake/modules/FindXSLT.cmake | |||
| @@ -0,0 +1,50 @@ | |||
| 1 | #.rst: | ||
| 2 | # FindXSLT | ||
| 3 | # -------- | ||
| 4 | # Finds the XSLT library | ||
| 5 | # | ||
| 6 | # This will will define the following variables:: | ||
| 7 | # | ||
| 8 | # XSLT_FOUND - system has XSLT | ||
| 9 | # XSLT_INCLUDE_DIRS - the XSLT include directory | ||
| 10 | # XSLT_LIBRARIES - the XSLT libraries | ||
| 11 | # XSLT_DEFINITIONS - the XSLT definitions | ||
| 12 | # | ||
| 13 | # and the following imported targets:: | ||
| 14 | # | ||
| 15 | # XSLT::XSLT - The XSLT library | ||
| 16 | |||
| 17 | find_package(LibXml2 REQUIRED) | ||
| 18 | |||
| 19 | if(PKG_CONFIG_FOUND) | ||
| 20 | pkg_check_modules(PC_XSLT libxslt QUIET) | ||
| 21 | endif() | ||
| 22 | |||
| 23 | find_path(XSLT_INCLUDE_DIR NAMES libxslt/xslt.h | ||
| 24 | PATHS ${PC_XSLT_INCLUDEDIR}) | ||
| 25 | find_library(XSLT_LIBRARY NAMES xslt libxslt | ||
| 26 | PATHS ${PC_XSLT_LIBDIR}) | ||
| 27 | |||
| 28 | set(XSLT_VERSION ${PC_XSLT_VERSION}) | ||
| 29 | |||
| 30 | include(FindPackageHandleStandardArgs) | ||
| 31 | find_package_handle_standard_args(XSLT | ||
| 32 | REQUIRED_VARS XSLT_LIBRARY XSLT_INCLUDE_DIR | ||
| 33 | VERSION_VAR XSLT_VERSION) | ||
| 34 | |||
| 35 | if(XSLT_FOUND) | ||
| 36 | set(XSLT_LIBRARIES ${XSLT_LIBRARY} ${LIBXML2_LIBRARIES}) | ||
| 37 | set(XSLT_INCLUDE_DIRS ${XSLT_INCLUDE_DIR} ${LIBXML2_INCLUDE_DIR}) | ||
| 38 | set(XSLT_DEFINITIONS -DHAVE_LIBXSLT=1) | ||
| 39 | |||
| 40 | if(NOT TARGET XSLT::XSLT) | ||
| 41 | add_library(XSLT::XSLT UNKNOWN IMPORTED) | ||
| 42 | set_target_properties(XSLT::XSLT PROPERTIES | ||
| 43 | IMPORTED_LOCATION "${XSLT_LIBRARY}" | ||
| 44 | INTERFACE_INCLUDE_DIRECTORIES "${XSLT_INCLUDE_DIR} ${LIBXML2_INCLUDE_DIR}" | ||
| 45 | INTERFACE_COMPILE_DEFINITIONS HAVE_LIBXSLT=1 | ||
| 46 | ITERFACE_LINK_LIBRARIES "${LIBXML2_LIBRARIES}") | ||
| 47 | endif() | ||
| 48 | endif() | ||
| 49 | |||
| 50 | mark_as_advanced(XSLT_INCLUDE_DIR XSLT_LIBRARY) | ||
