1 # - Try to find the LibXslt library
2 # Once done this will define
4 # LIBXSLT_FOUND - system has LibXslt
5 # LIBXSLT_INCLUDE_DIR - the LibXslt include directory
6 # LIBXSLT_LIBRARIES - Link these to LibXslt
7 # LIBXSLT_DEFINITIONS - Compiler switches required for using LibXslt
8 # LIBXSLT_VERSION_STRING - version of LibXslt found (since CMake 2.8.8)
9 # Additionally, the following two variables are set (but not required for using xslt):
10 # LIBXSLT_EXSLT_LIBRARIES - Link to these if you need to link against the exslt library
11 # LIBXSLT_XSLTPROC_EXECUTABLE - Contains the full path to the xsltproc executable if found
13 #=============================================================================
14 # Copyright 2006-2009 Kitware, Inc.
15 # Copyright 2006 Alexander Neundorf <neundorf@kde.org>
17 # Distributed under the OSI-approved BSD License (the "License");
18 # see accompanying file Copyright.txt for details.
20 # This software is distributed WITHOUT ANY WARRANTY; without even the
21 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
22 # See the License for more information.
23 #=============================================================================
24 # (To distribute this file outside of CMake, substitute the full
25 # License text for the above reference.)
27 # use pkg-config to get the directories and then use these values
28 # in the find_path() and find_library() calls
29 find_package(PkgConfig QUIET)
30 PKG_CHECK_MODULES(PC_LIBXSLT QUIET libxslt)
31 set(LIBXSLT_DEFINITIONS ${PC_LIBXSLT_CFLAGS_OTHER})
33 find_path(LIBXSLT_INCLUDE_DIR NAMES libxslt/xslt.h
35 ${PC_LIBXSLT_INCLUDEDIR}
36 ${PC_LIBXSLT_INCLUDE_DIRS}
39 find_library(LIBXSLT_LIBRARIES NAMES xslt libxslt
42 ${PC_LIBXSLT_LIBRARY_DIRS}
45 find_library(LIBXSLT_EXSLT_LIBRARY NAMES exslt libexslt
48 ${PC_LIBXSLT_LIBRARY_DIRS}
51 set(LIBXSLT_EXSLT_LIBRARIES ${LIBXSLT_EXSLT_LIBRARY} )
53 find_program(LIBXSLT_XSLTPROC_EXECUTABLE xsltproc)
55 if(PC_LIBXSLT_VERSION)
56 set(LIBXSLT_VERSION_STRING ${PC_LIBXSLT_VERSION})
57 elseif(LIBXSLT_INCLUDE_DIR AND EXISTS "${LIBXSLT_INCLUDE_DIR}/libxslt/xsltconfig.h")
58 file(STRINGS "${LIBXSLT_INCLUDE_DIR}/libxslt/xsltconfig.h" libxslt_version_str
59 REGEX "^#define[\t ]+LIBXSLT_DOTTED_VERSION[\t ]+\".*\"")
61 string(REGEX REPLACE "^#define[\t ]+LIBXSLT_DOTTED_VERSION[\t ]+\"([^\"]*)\".*" "\\1"
62 LIBXSLT_VERSION_STRING "${libxslt_version_str}")
63 unset(libxslt_version_str)
66 include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
67 FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXslt
68 REQUIRED_VARS LIBXSLT_LIBRARIES LIBXSLT_INCLUDE_DIR
69 VERSION_VAR LIBXSLT_VERSION_STRING)
71 mark_as_advanced(LIBXSLT_INCLUDE_DIR
74 LIBXSLT_XSLTPROC_EXECUTABLE)