Permalink
Browse files

Fix fontconfig detection for cairo on xquartz (#4617)

  • Loading branch information...
1 parent b0b057e commit 70f0eb87c74e68712709e689318d9a6e6a391876 @tbonfort tbonfort committed Apr 4, 2013
Showing with 12 additions and 3 deletions.
  1. +1 −1 CMakeLists.txt
  2. +11 −2 cmake/FindCairo.cmake
View
@@ -328,7 +328,7 @@ endif(WITH_GENERIC_NINT)
if(WITH_CAIRO)
find_package(Cairo)
if(CAIRO_FOUND)
- include_directories(${CAIRO_INCLUDE_DIR})
+ include_directories(${CAIRO_INCLUDE_DIRS})
ms_link_libraries( ${CAIRO_LIBRARY})
set (USE_CAIRO 1)
else(CAIRO_FOUND)
View
@@ -34,10 +34,19 @@ PKG_CHECK_MODULES(PC_CAIRO cairo) # FIXME: After we require CMake 2.8.2 we can p
FIND_PATH(CAIRO_INCLUDE_DIR
NAMES cairo.h
HINTS ${PC_CAIRO_INCLUDEDIR}
- ${PC_CAIRO_INCLUDE_DIR}
+ ${PC_CAIRO_INCLUDE_DIRS}
PATH_SUFFIXES cairo
)
+IF(APPLE)
+ #On Mountain Lion we need this for the XQuartz supplied version of cairo
+ PKG_CHECK_MODULES(PC_FONTCONFIG fontconfig) # FIXME: After we require CMake 2.8.2 we can pass QUIET to this call.
+ FIND_PATH(FC_INCLUDE_DIR
+ NAMES fontconfig/fontconfig.h
+ HINTS ${PC_FONTCONFIG_INCLUDEDIR}
+ )
+ENDIF(APPLE)
+
FIND_LIBRARY(CAIRO_LIBRARY
NAMES cairo
HINTS ${PC_CAIRO_LIBDIR}
@@ -61,7 +70,7 @@ IF (CAIRO_INCLUDE_DIR)
ENDIF ()
ENDIF ()
-set(CAIRO_INCLUDE_DIRS ${CAIRO_INCLUDE_DIR})
+set(CAIRO_INCLUDE_DIRS ${CAIRO_INCLUDE_DIR} ${FC_INCLUDE_DIR})
set(CAIRO_LIBRARIES ${CAIRO_LIBRARY})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(CAIRO DEFAULT_MSG CAIRO_LIBRARY CAIRO_INCLUDE_DIR)

0 comments on commit 70f0eb8

Please sign in to comment.