|
Packit Service |
b1ea74 |
# - Try to find the CAIRO library
|
|
Packit Service |
b1ea74 |
# Once done this will define
|
|
Packit Service |
b1ea74 |
#
|
|
Packit Service |
b1ea74 |
# CAIRO_ROOT_DIR - Set this variable to the root installation of CAIRO
|
|
Packit Service |
b1ea74 |
#
|
|
Packit Service |
b1ea74 |
# Read-Only variables:
|
|
Packit Service |
b1ea74 |
# CAIRO_FOUND - system has the CAIRO library
|
|
Packit Service |
b1ea74 |
# CAIRO_INCLUDE_DIR - the CAIRO include directory
|
|
Packit Service |
b1ea74 |
# CAIRO_LIBRARIES - The libraries needed to use CAIRO
|
|
Packit Service |
b1ea74 |
# CAIRO_VERSION - This is set to $major.$minor.$revision (eg. 0.9.8)
|
|
Packit Service |
b1ea74 |
|
|
Packit Service |
b1ea74 |
#=============================================================================
|
|
Packit Service |
b1ea74 |
# Copyright 2012 Dmitry Baryshnikov <polimax at mail dot ru>
|
|
Packit Service |
b1ea74 |
#
|
|
Packit Service |
b1ea74 |
# Distributed under the OSI-approved BSD License (the "License");
|
|
Packit Service |
b1ea74 |
# see accompanying file Copyright.txt for details.
|
|
Packit Service |
b1ea74 |
#
|
|
Packit Service |
b1ea74 |
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
Packit Service |
b1ea74 |
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
Packit Service |
b1ea74 |
# See the License for more information.
|
|
Packit Service |
b1ea74 |
#=============================================================================
|
|
Packit Service |
b1ea74 |
# (To distribute this file outside of CMake, substitute the full
|
|
Packit Service |
b1ea74 |
# License text for the above reference.)
|
|
Packit Service |
b1ea74 |
|
|
Packit Service |
b1ea74 |
find_package(PkgConfig)
|
|
Packit Service |
b1ea74 |
|
|
Packit Service |
b1ea74 |
if(PKG_CONFIG_FOUND)
|
|
Packit Service |
b1ea74 |
pkg_check_modules(_CAIRO cairo)
|
|
Packit Service |
b1ea74 |
endif (PKG_CONFIG_FOUND)
|
|
Packit Service |
b1ea74 |
|
|
Packit Service |
b1ea74 |
SET(_CAIRO_ROOT_HINTS
|
|
Packit Service |
b1ea74 |
$ENV{CAIRO}
|
|
Packit Service |
b1ea74 |
${CAIRO_ROOT_DIR}
|
|
Packit Service |
b1ea74 |
)
|
|
Packit Service |
b1ea74 |
SET(_CAIRO_ROOT_PATHS
|
|
Packit Service |
b1ea74 |
$ENV{CAIRO}/src
|
|
Packit Service |
b1ea74 |
/usr
|
|
Packit Service |
b1ea74 |
/usr/local
|
|
Packit Service |
b1ea74 |
)
|
|
Packit Service |
b1ea74 |
SET(_CAIRO_ROOT_HINTS_AND_PATHS
|
|
Packit Service |
b1ea74 |
HINTS ${_CAIRO_ROOT_HINTS}
|
|
Packit Service |
b1ea74 |
PATHS ${_CAIRO_ROOT_PATHS}
|
|
Packit Service |
b1ea74 |
)
|
|
Packit Service |
b1ea74 |
|
|
Packit Service |
b1ea74 |
FIND_PATH(CAIRO_INCLUDE_DIR
|
|
Packit Service |
b1ea74 |
NAMES
|
|
Packit Service |
b1ea74 |
cairo.h
|
|
Packit Service |
b1ea74 |
HINTS
|
|
Packit Service |
b1ea74 |
${_CAIRO_INCLUDEDIR}
|
|
Packit Service |
b1ea74 |
${_CAIRO_ROOT_HINTS_AND_PATHS}
|
|
Packit Service |
b1ea74 |
PATH_SUFFIXES
|
|
Packit Service |
b1ea74 |
include
|
|
Packit Service |
b1ea74 |
"include/cairo"
|
|
Packit Service |
b1ea74 |
)
|
|
Packit Service |
b1ea74 |
|
|
Packit Service |
b1ea74 |
IF(NOT PKGCONFIG_FOUND AND WIN32 AND NOT CYGWIN)
|
|
Packit Service |
b1ea74 |
# MINGW should go here too
|
|
Packit Service |
b1ea74 |
IF(MSVC)
|
|
Packit Service |
b1ea74 |
# Implementation details:
|
|
Packit Service |
b1ea74 |
# We are using the libraries located in the VC subdir instead of the parent directory eventhough :
|
|
Packit Service |
b1ea74 |
FIND_LIBRARY(CAIRO_DEBUG
|
|
Packit Service |
b1ea74 |
NAMES
|
|
Packit Service |
b1ea74 |
cairod
|
|
Packit Service |
b1ea74 |
${_CAIRO_ROOT_HINTS_AND_PATHS}
|
|
Packit Service |
b1ea74 |
PATH_SUFFIXES
|
|
Packit Service |
b1ea74 |
"lib"
|
|
Packit Service |
b1ea74 |
"VC"
|
|
Packit Service |
b1ea74 |
"lib/VC"
|
|
Packit Service |
b1ea74 |
)
|
|
Packit Service |
b1ea74 |
|
|
Packit Service |
b1ea74 |
FIND_LIBRARY(CAIRO_RELEASE
|
|
Packit Service |
b1ea74 |
NAMES
|
|
Packit Service |
b1ea74 |
cairo
|
|
Packit Service |
b1ea74 |
${_CAIRO_ROOT_HINTS_AND_PATHS}
|
|
Packit Service |
b1ea74 |
PATH_SUFFIXES
|
|
Packit Service |
b1ea74 |
"lib"
|
|
Packit Service |
b1ea74 |
"VC"
|
|
Packit Service |
b1ea74 |
"lib/VC"
|
|
Packit Service |
b1ea74 |
)
|
|
Packit Service |
b1ea74 |
|
|
Packit Service |
b1ea74 |
if( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
|
|
Packit Service |
b1ea74 |
if(NOT CAIRO_DEBUG)
|
|
Packit Service |
b1ea74 |
set(CAIRO_DEBUG ${CAIRO_RELEASE})
|
|
Packit Service |
b1ea74 |
endif(NOT CAIRO_DEBUG)
|
|
Packit Service |
b1ea74 |
set( CAIRO_LIBRARIES
|
|
Packit Service |
b1ea74 |
optimized ${CAIRO_RELEASE} debug ${CAIRO_DEBUG}
|
|
Packit Service |
b1ea74 |
)
|
|
Packit Service |
b1ea74 |
else()
|
|
Packit Service |
b1ea74 |
set( CAIRO_LIBRARIES ${CAIRO_RELEASE})
|
|
Packit Service |
b1ea74 |
endif()
|
|
Packit Service |
b1ea74 |
MARK_AS_ADVANCED(CAIRO_DEBUG CAIRO_RELEASE)
|
|
Packit Service |
b1ea74 |
ELSEIF(MINGW)
|
|
Packit Service |
b1ea74 |
# same player, for MingW
|
|
Packit Service |
b1ea74 |
FIND_LIBRARY(CAIRO
|
|
Packit Service |
b1ea74 |
NAMES
|
|
Packit Service |
b1ea74 |
cairo
|
|
Packit Service |
b1ea74 |
${_CAIRO_ROOT_HINTS_AND_PATHS}
|
|
Packit Service |
b1ea74 |
PATH_SUFFIXES
|
|
Packit Service |
b1ea74 |
"lib"
|
|
Packit Service |
b1ea74 |
"lib/MinGW"
|
|
Packit Service |
b1ea74 |
)
|
|
Packit Service |
b1ea74 |
|
|
Packit Service |
b1ea74 |
MARK_AS_ADVANCED(CAIRO)
|
|
Packit Service |
b1ea74 |
set( CAIRO_LIBRARIES ${CAIRO})
|
|
Packit Service |
b1ea74 |
ELSE(MSVC)
|
|
Packit Service |
b1ea74 |
# Not sure what to pick for -say- intel, let's use the toplevel ones and hope someone report issues:
|
|
Packit Service |
b1ea74 |
FIND_LIBRARY(CAIRO
|
|
Packit Service |
b1ea74 |
NAMES
|
|
Packit Service |
b1ea74 |
cairo
|
|
Packit Service |
b1ea74 |
HINTS
|
|
Packit Service |
b1ea74 |
${_CAIRO_LIBDIR}
|
|
Packit Service |
b1ea74 |
${_CAIRO_ROOT_HINTS_AND_PATHS}
|
|
Packit Service |
b1ea74 |
PATH_SUFFIXES
|
|
Packit Service |
b1ea74 |
lib
|
|
Packit Service |
b1ea74 |
)
|
|
Packit Service |
b1ea74 |
|
|
Packit Service |
b1ea74 |
MARK_AS_ADVANCED(CAIRO)
|
|
Packit Service |
b1ea74 |
set( CAIRO_LIBRARIES ${CAIRO} )
|
|
Packit Service |
b1ea74 |
ENDIF(MSVC)
|
|
Packit Service |
b1ea74 |
ELSE()
|
|
Packit Service |
b1ea74 |
|
|
Packit Service |
b1ea74 |
FIND_LIBRARY(CAIRO_LIBRARY
|
|
Packit Service |
b1ea74 |
NAMES
|
|
Packit Service |
b1ea74 |
cairo
|
|
Packit Service |
b1ea74 |
HINTS
|
|
Packit Service |
b1ea74 |
${_CAIRO_LIBDIR}
|
|
Packit Service |
b1ea74 |
${_CAIRO_ROOT_HINTS_AND_PATHS}
|
|
Packit Service |
b1ea74 |
PATH_SUFFIXES
|
|
Packit Service |
b1ea74 |
"lib"
|
|
Packit Service |
b1ea74 |
"local/lib"
|
|
Packit Service |
b1ea74 |
)
|
|
Packit Service |
b1ea74 |
|
|
Packit Service |
b1ea74 |
MARK_AS_ADVANCED(CAIRO_LIBRARY)
|
|
Packit Service |
b1ea74 |
|
|
Packit Service |
b1ea74 |
# compat defines
|
|
Packit Service |
b1ea74 |
SET(CAIRO_LIBRARIES ${CAIRO_LIBRARY})
|
|
Packit Service |
b1ea74 |
|
|
Packit Service |
b1ea74 |
ENDIF()
|
|
Packit Service |
b1ea74 |
|
|
Packit Service |
b1ea74 |
#message( STATUS "Cairo_FIND_VERSION=${Cairo_FIND_VERSION}.")
|
|
Packit Service |
b1ea74 |
#message( STATUS "CAIRO_INCLUDE_DIR=${CAIRO_INCLUDE_DIR}.")
|
|
Packit Service |
b1ea74 |
|
|
Packit Service |
b1ea74 |
# Fetch version from cairo-version.h if a version was requested by find_package()
|
|
Packit Service |
b1ea74 |
if(CAIRO_INCLUDE_DIR AND Cairo_FIND_VERSION)
|
|
Packit Service |
b1ea74 |
file(READ "${CAIRO_INCLUDE_DIR}/cairo-version.h" _CAIRO_VERSION_H_CONTENTS)
|
|
Packit Service |
b1ea74 |
string(REGEX REPLACE "^(.*\n)?#define[ \t]+CAIRO_VERSION_MAJOR[ \t]+([0-9]+).*"
|
|
Packit Service |
b1ea74 |
"\\2" CAIRO_VERSION_MAJOR ${_CAIRO_VERSION_H_CONTENTS})
|
|
Packit Service |
b1ea74 |
string(REGEX REPLACE "^(.*\n)?#define[ \t]+CAIRO_VERSION_MINOR[ \t]+([0-9]+).*"
|
|
Packit Service |
b1ea74 |
"\\2" CAIRO_VERSION_MINOR ${_CAIRO_VERSION_H_CONTENTS})
|
|
Packit Service |
b1ea74 |
string(REGEX REPLACE "^(.*\n)?#define[ \t]+CAIRO_VERSION_MICRO[ \t]+([0-9]+).*"
|
|
Packit Service |
b1ea74 |
"\\2" CAIRO_VERSION_MICRO ${_CAIRO_VERSION_H_CONTENTS})
|
|
Packit Service |
b1ea74 |
set(CAIRO_VERSION ${CAIRO_VERSION_MAJOR}.${CAIRO_VERSION_MINOR}.${CAIRO_VERSION_MICRO}
|
|
Packit Service |
b1ea74 |
CACHE INTERNAL "The version number for Cairo libraries")
|
|
Packit Service |
b1ea74 |
endif()
|
|
Packit Service |
b1ea74 |
|
|
Packit Service |
b1ea74 |
include(FindPackageHandleStandardArgs)
|
|
Packit Service |
b1ea74 |
|
|
Packit Service |
b1ea74 |
find_package_handle_standard_args(Cairo
|
|
Packit Service |
b1ea74 |
REQUIRED_VARS
|
|
Packit Service |
b1ea74 |
CAIRO_LIBRARIES
|
|
Packit Service |
b1ea74 |
CAIRO_INCLUDE_DIR
|
|
Packit Service |
b1ea74 |
VERSION_VAR
|
|
Packit Service |
b1ea74 |
CAIRO_VERSION
|
|
Packit Service |
b1ea74 |
)
|
|
Packit Service |
b1ea74 |
|
|
Packit Service |
b1ea74 |
MARK_AS_ADVANCED(CAIRO_INCLUDE_DIR CAIRO_LIBRARIES)
|