c43e8c459ef8a48adf6b336c1a8a13cfe0415065Campbell Barton# - Try to find PopplerCairo
c43e8c459ef8a48adf6b336c1a8a13cfe0415065Campbell Barton# Once done this will define
c43e8c459ef8a48adf6b336c1a8a13cfe0415065Campbell Barton# POPPLER_FOUND - system has PopplerCairo
c43e8c459ef8a48adf6b336c1a8a13cfe0415065Campbell Barton# POPPLER_INCLUDE_DIRS - the PopplerCairo include directory
c43e8c459ef8a48adf6b336c1a8a13cfe0415065Campbell Barton# POPPLER_LIBRARIES - Link these to use PopplerCairo
c43e8c459ef8a48adf6b336c1a8a13cfe0415065Campbell Barton# POPPLER_DEFINITIONS - Compiler switches required for using PopplerCairo
c43e8c459ef8a48adf6b336c1a8a13cfe0415065Campbell Barton# Copyright (c) 2008 Joshua L. Blocher <verbalshadow@gmail.com>
c43e8c459ef8a48adf6b336c1a8a13cfe0415065Campbell Barton# Redistribution and use is allowed according to the terms of the New
c43e8c459ef8a48adf6b336c1a8a13cfe0415065Campbell Barton# BSD license.
c43e8c459ef8a48adf6b336c1a8a13cfe0415065Campbell Barton# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
c43e8c459ef8a48adf6b336c1a8a13cfe0415065Campbell Bartoninclude(${CMAKE_CURRENT_LIST_DIR}/../HelperMacros.cmake)
c43e8c459ef8a48adf6b336c1a8a13cfe0415065Campbell Bartonif (POPPLER_LIBRARIES AND POPPLER_INCLUDE_DIRS)
c43e8c459ef8a48adf6b336c1a8a13cfe0415065Campbell Barton # in cache already
c43e8c459ef8a48adf6b336c1a8a13cfe0415065Campbell Barton set(POPPLER_FOUND TRUE)
c43e8c459ef8a48adf6b336c1a8a13cfe0415065Campbell Bartonelse (POPPLER_LIBRARIES AND POPPLER_INCLUDE_DIRS)
c43e8c459ef8a48adf6b336c1a8a13cfe0415065Campbell Barton # use pkg-config to get the directories and then use these values
c43e8c459ef8a48adf6b336c1a8a13cfe0415065Campbell Barton # in the FIND_PATH() and FIND_LIBRARY() calls
c43e8c459ef8a48adf6b336c1a8a13cfe0415065Campbell Barton find_package(PkgConfig)
c43e8c459ef8a48adf6b336c1a8a13cfe0415065Campbell Barton if (PKG_CONFIG_FOUND)
438b0b70ad930bf7fe997fc7064be1c09138438bAlex Valavanis INKSCAPE_PKG_CONFIG_FIND(POPPLER poppler >=0.20.0 poppler-config.h poppler poppler)
c43e8c459ef8a48adf6b336c1a8a13cfe0415065Campbell Barton if (POPPLER_FOUND)
438b0b70ad930bf7fe997fc7064be1c09138438bAlex Valavanis INKSCAPE_PKG_CONFIG_FIND(POPPLER_GLIB poppler-glib >=0.20.0 poppler/glib/poppler.h "" poppler-glib)
c43e8c459ef8a48adf6b336c1a8a13cfe0415065Campbell Barton if (POPPLER_GLIB_FOUND)
c43e8c459ef8a48adf6b336c1a8a13cfe0415065Campbell Barton list(APPEND POPPLER_INCLUDE_DIRS ${POPPLER_GLIB_INCLUDE_DIRS})
c43e8c459ef8a48adf6b336c1a8a13cfe0415065Campbell Barton list(APPEND POPPLER_LIBRARIES ${POPPLER_GLIB_LIBRARIES})
c43e8c459ef8a48adf6b336c1a8a13cfe0415065Campbell Barton INKSCAPE_PKG_CONFIG_FIND(CAIRO_SVG cairo-svg 0 cairo-svg.h cairo cairo)
c43e8c459ef8a48adf6b336c1a8a13cfe0415065Campbell Barton if (CAIRO_SVG_FOUND)
c43e8c459ef8a48adf6b336c1a8a13cfe0415065Campbell Barton list(APPEND POPPLER_INCLUDE_DIRS ${CAIRO_SVG_INCLUDE_DIRS})
c43e8c459ef8a48adf6b336c1a8a13cfe0415065Campbell Barton list(APPEND POPPLER_LIBRARIES ${CAIRO_SVG_LIBRARIES})
c43e8c459ef8a48adf6b336c1a8a13cfe0415065Campbell Barton endif (CAIRO_SVG_FOUND)
c43e8c459ef8a48adf6b336c1a8a13cfe0415065Campbell Barton endif (POPPLER_GLIB_FOUND)
c43e8c459ef8a48adf6b336c1a8a13cfe0415065Campbell Barton if (ENABLE_POPPLER_CAIRO)
438b0b70ad930bf7fe997fc7064be1c09138438bAlex Valavanis INKSCAPE_PKG_CONFIG_FIND(POPPLER_CAIRO poppler-cairo >=0.20.0 cairo.h cairo cairo)
c43e8c459ef8a48adf6b336c1a8a13cfe0415065Campbell Barton if (POPPLER_GLIB_FOUND AND POPPLER_CAIRO_FOUND AND NOT CAIRO_SVG_FOUND)
c43e8c459ef8a48adf6b336c1a8a13cfe0415065Campbell Barton list(APPEND POPPLER_INCLUDE_DIRS ${POPPLER_CAIRO_INCLUDE_DIRS})
c43e8c459ef8a48adf6b336c1a8a13cfe0415065Campbell Barton list(APPEND POPPLER_LIBRARIES ${POPPLER_CAIRO_LIBRARIES})
c43e8c459ef8a48adf6b336c1a8a13cfe0415065Campbell Barton endif (POPPLER_GLIB_FOUND AND POPPLER_CAIRO_FOUND AND NOT CAIRO_SVG_FOUND)
c43e8c459ef8a48adf6b336c1a8a13cfe0415065Campbell Barton endif (ENABLE_POPPLER_CAIRO)
c43e8c459ef8a48adf6b336c1a8a13cfe0415065Campbell Barton endif (POPPLER_FOUND)
c43e8c459ef8a48adf6b336c1a8a13cfe0415065Campbell Barton endif (PKG_CONFIG_FOUND)
c43e8c459ef8a48adf6b336c1a8a13cfe0415065Campbell Bartonendif (POPPLER_LIBRARIES AND POPPLER_INCLUDE_DIRS)