Subversion Repositories Scribus

Rev

Rev 12131 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
5157 cbradney 1
#
2
# Find the native cairo includes and library
3
#
4
 
5
# This module defines
6
# CAIRO_INCLUDE_DIR, where to find art*.h etc
7
# CAIRO_LIBRARY, the libraries to link against to use LIBART.
8
# CAIRO_FOUND, If false, do not try to use LIBART.
9
# CAIRO_LIBS, link information
10
# CAIRO_CFLAGS, cflags for include information
11
 
12
 
5750 cbradney 13
IF(PREFIX_CAIRO)
7341 cbradney 14
  MESSAGE(STATUS "Searching custom cairo location: ${PREFIX_CAIRO}")
15
  SET(PREFIX_CAIRO_INCLUDE "${PREFIX_CAIRO}/include")
16
  SET(PREFIX_CAIRO_LIB "${PREFIX_CAIRO}/lib")
17
  SET(PREFIX_CAIRO_BIN "${PREFIX_CAIRO}/bin")
18
ELSE(PREFIX_CAIRO)
19
  # use pkgconfig to get the directories and then use these values
20
  # in the FIND_PATH() and FIND_LIBRARY() calls
7344 cbradney 21
  IF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.5)
22
    INCLUDE(UsePkgConfig)
23
    PKGCONFIG(cairo _libCairoIncDir _libCairoLinkDir _libCairoLinkFlags _libCairoCflags)
24
    SET(PKG_CAIRO_INCLUDE_DIRS ${_libCairoIncDir})
25
    SET(PKG_CAIRO_LIBRARIES ${_libCairoLinkDir})
26
  ELSE (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.5)
27
    INCLUDE(FindPkgConfig)
18495 jghali 28
    pkg_search_module(CAIRO REQUIRED libcairo>=1.10.0 cairo>=1.10.0)
7344 cbradney 29
  ENDIF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.5)
5750 cbradney 30
ENDIF(PREFIX_CAIRO)
31
 
5749 cbradney 32
FIND_PATH(CAIRO_INCLUDE_DIR
7341 cbradney 33
  NAMES cairo.h
12131 cbradney 34
  PATHS ${PREFIX_CAIRO_INCLUDE} ${PKG_CAIRO_INCLUDE_DIRS} ${CAIRO_INCLUDE_DIRS} /usr/local/include /usr/include
7341 cbradney 35
  PATH_SUFFIXES cairo
36
  NO_DEFAULT_PATH
5157 cbradney 37
)
38
 
5749 cbradney 39
FIND_LIBRARY(CAIRO_LIBRARY
7341 cbradney 40
  NAMES libcairo cairo
12131 cbradney 41
  PATHS ${PREFIX_CAIRO_LIB} ${PKG_CAIRO_LIBRARIES} ${CAIRO_LIBRARY_DIRS} /usr/local/lib /usr/lib
7341 cbradney 42
  NO_DEFAULT_PATH
5157 cbradney 43
)
44
 
5790 cbradney 45
#If we had no cairo prefix specify it, set PREFIX_CAIRO_LIB most importantly, for the
46
# IF(NOT PREFIX_CAIRO)
47
# 	GET_FILENAME_COMPONENT(CAIRO_DIR ${CAIRO_LIBRARY} PATH)
48
# 	GET_FILENAME_COMPONENT(CAIRO_DIR ${CAIRO_DIR} PATH)
49
# 	SET(PREFIX_CAIRO ${CAIRO_DIR})
50
# 	IF(PREFIX_CAIRO)
51
# 		SET(PREFIX_CAIRO_INCLUDE "${PREFIX_CAIRO}/include")
52
# 		SET(PREFIX_CAIRO_LIB "${PREFIX_CAIRO}/lib")
53
# 		SET(PREFIX_CAIRO_BIN "${PREFIX_CAIRO}/bin")
54
# 	ENDIF(PREFIX_CAIRO)
55
# ENDIF(NOT PREFIX_CAIRO)
56
 
5157 cbradney 57
SET(CAIRO_FIND_QUIETLY 1)
58
 
59
IF (CAIRO_LIBRARY)
60
  IF (CAIRO_INCLUDE_DIR)
61
    SET( CAIRO_FOUND "YES" )
62
    IF(NOT CAIRO_FIND_QUIETLY)
63
      MESSAGE(STATUS "Found cairo: ${CAIRO_LIBRARY}")
64
    ENDIF(NOT CAIRO_FIND_QUIETLY)
65
    SET( CAIRO_LIBRARIES ${CAIRO_LIBRARY} )
5790 cbradney 66
#     CB: We dont use this yet anyway
67
#     FIND_PROGRAM(CAIRO_CONFIG
68
#       NAMES pkg-config
69
#       PATHS ${prefix}/bin ${exec_prefix}/bin /usr/local/bin /opt/local/bin /usr/bin /usr/nekoware/bin /usr/X11/bin
70
#     )
71
#     EXEC_PROGRAM(${CAIRO_CONFIG} ARGS "--libs cairo" OUTPUT_VARIABLE CAIRO_LIBS)
72
#     EXEC_PROGRAM(${CAIRO_CONFIG} ARGS "--cflags cairo" OUTPUT_VARIABLE CAIRO_CFLAGS)
5157 cbradney 73
  ENDIF (CAIRO_INCLUDE_DIR)
5758 cbradney 74
ENDIF (CAIRO_LIBRARY)