1 # from http://zi.fi/cmake/Modules/FindCairo.cmake
5 # Once done, this will define
7 # Cairo_FOUND - system has Cairo
8 # Cairo_INCLUDE_DIRS - the Cairo include directories
9 # Cairo_LIBRARIES - link these to use Cairo
11 include(LibFindMacros)
12 include(CheckCSourceCompiles)
15 libfind_package(Cairo Freetype)
17 # Use pkg-config to get hints about paths
18 libfind_pkg_check_modules(Cairo_PKGCONF cairo)
21 find_path(Cairo_INCLUDE_DIR
23 PATHS ${Cairo_PKGCONF_INCLUDE_DIRS}
27 # Finally the library itself
28 find_library(Cairo_LIBRARY
30 PATHS ${Cairo_PKGCONF_LIBRARY_DIRS}
33 # Set the include dir variables and the libraries and let libfind_process do the rest.
34 # NOTE: Singular variables for this library, plural for libraries this this lib depends on.
35 set(Cairo_PROCESS_INCLUDES Cairo_INCLUDE_DIR Freetype_INCLUDE_DIRS)
36 set(Cairo_PROCESS_LIBS Cairo_LIBRARY Freetype_LIBRARIES)
37 libfind_process(Cairo)
41 #### check if cairo works
43 SET(CMAKE_REQUIRED_FLAGS ${CAIRO_CFLAGS} ${CAIRO_CFLAGS_OTHERS})
44 SET(CMAKE_REQUIRED_INCLUDES ${Cairo_INCLUDE_DIRS})
45 SET(CMAKE_REQUIRED_LIBRARIES ${Cairo_LIBRARIES})
46 #SET(CMAKE_REQUIRED_LIBDIRS ${CAIRO_LIBRARY_DIRS})
49 CHECK_C_SOURCE_COMPILES( "#include <cairo.h>
51 cairo_surface_t *surface;
52 surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 120, 120);
56 MESSAGE(STATUS "Cairo works")
58 MESSAGE(WARNING "Cairo is not working properly: disabling")