FindXSLT.cmake revision 0586e948b7fc1e97fa7cdddf926e4ec768a40392
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan# - Try to find XSLT
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan# Once done this will define
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan#
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan# XSLT_FOUND - system has XSLT
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan# XSLT_INCLUDE_DIRS - the XSLT include directory
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan# XSLT_LIBRARIES - Link these to use XSLT
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan# XSLT_DEFINITIONS - Compiler switches required for using XSLT
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan#
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan# Copyright (c) 2008 Joshua L. Blocher <verbalshadow@gmail.com>
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan#
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan# Redistribution and use is allowed according to the terms of the New
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan# BSD license.
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan#
f0b8f6dd844f8752946b865bdd44175863b15812Peter Major
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan
5ec701c9f8ccc403ee6fd3e41239df7dcd9faddeBruno Lavitif (XSLT_LIBRARIES AND XSLT_INCLUDE_DIRS)
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan # in cache already
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan set(XSLT_FOUND TRUE)
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hoganelse (XSLT_LIBRARIES AND XSLT_INCLUDE_DIRS)
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan # use pkg-config to get the directories and then use these values
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan # in the FIND_PATH() and FIND_LIBRARY() calls
2d8eba3efb0ced5c2ab004e5b3e949094747aeb3jenkins if (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan include(UsePkgConfig)
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan pkgconfig(libxslt _XSLT_INCLUDEDIR _XSLT_LIBDIR _XSLT_LDFLAGS _XSLT_CFLAGS)
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan else (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan find_package(PkgConfig)
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan if (PKG_CONFIG_FOUND)
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan pkg_check_modules(_XSLT libxslt)
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan endif (PKG_CONFIG_FOUND)
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan endif (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan find_path(XSLT_INCLUDE_DIR
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan NAMES
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan xslt.h
3744900be632496920d4c9aca8f94ba6db4dd882Dirk Hogan PATHS
3744900be632496920d4c9aca8f94ba6db4dd882Dirk Hogan ${_XSLT_INCLUDEDIR}
3744900be632496920d4c9aca8f94ba6db4dd882Dirk Hogan /usr/include
3744900be632496920d4c9aca8f94ba6db4dd882Dirk Hogan /usr/local/include
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan /opt/local/include
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan /sw/include
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan PATH_SUFFIXES
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan libxslt
61ea54c309169801a1833f99729723071c24c047Dirk Hogan )
61ea54c309169801a1833f99729723071c24c047Dirk Hogan
61ea54c309169801a1833f99729723071c24c047Dirk Hogan find_library(XSLT_LIBRARY
61ea54c309169801a1833f99729723071c24c047Dirk Hogan NAMES
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan xslt
55e32e1d339c1e3417aa96111d48d51eb29be585Dirk Hogan PATHS
55e32e1d339c1e3417aa96111d48d51eb29be585Dirk Hogan ${_XSLT_LIBDIR}
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan /usr/lib
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan /usr/local/lib
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan /opt/local/lib
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan /sw/lib
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan )
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan if (XSLT_LIBRARY)
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan set(XSLT_FOUND TRUE)
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan endif (XSLT_LIBRARY)
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan set(XSLT_INCLUDE_DIRS
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan ${XSLT_INCLUDE_DIR}
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan )
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan if (XSLT_FOUND)
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan set(XSLT_LIBRARIES
954d71f34d584a7bcc51a5df9933427542081d62Dirk Hogan ${XSLT_LIBRARIES}
${XSLT_LIBRARY}
)
endif (XSLT_FOUND)
if (XSLT_INCLUDE_DIRS AND XSLT_LIBRARIES)
set(XSLT_FOUND TRUE)
endif (XSLT_INCLUDE_DIRS AND XSLT_LIBRARIES)
if (XSLT_FOUND)
if (NOT XSLT_FIND_QUIETLY)
message(STATUS "Found XSLT: ${XSLT_LIBRARIES}")
endif (NOT XSLT_FIND_QUIETLY)
else (XSLT_FOUND)
if (XSLT_FIND_REQUIRED)
message(FATAL_ERROR "Could not find XSLT")
endif (XSLT_FIND_REQUIRED)
endif (XSLT_FOUND)
# show the XSLT_INCLUDE_DIRS and XSLT_LIBRARIES variables only in the advanced view
mark_as_advanced(XSLT_INCLUDE_DIRS XSLT_LIBRARIES)
endif (XSLT_LIBRARIES AND XSLT_INCLUDE_DIRS)