FONTCONFIGConfig.cmake 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #
  2. # Find the native FONTCONFIG includes and library
  3. #
  4. # This module defines
  5. # FONTCONFIG_INCLUDE_DIR, where to find art*.h etc
  6. # FONTCONFIG_LIBRARY, the libraries to link against to use FONTCONFIG.
  7. # FONTCONFIG_FOUND, If false, do not try to use FONTCONFIG.
  8. # LIBFONTCONFIG_LIBS, link information
  9. # LIBFONTCONFIG_CFLAGS, cflags for include information
  10. IF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.5)
  11. INCLUDE(UsePkgConfig)
  12. PKGCONFIG(fontconfig _fontconfigIncDir _fontconfigLinkDir _fontconfigLinkFlags _fontconfigCflags)
  13. SET(FONTCONFIG_LIBS ${_fontconfigCflags})
  14. ELSE (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.5)
  15. INCLUDE(FindPkgConfig)
  16. pkg_search_module(FONTCONFIG REQUIRED fontconfig)
  17. ENDIF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.5)
  18. #INCLUDE(UsePkgConfig)
  19. # use pkg-config to get the directories and then use these values
  20. # in the FIND_PATH() and FIND_LIBRARY() calls
  21. #PKGCONFIG(fontconfig _fontconfigIncDir _fontconfigLinkDir _fontconfigLinkFlags _fontconfigCflags)
  22. #SET(FONTCONFIG_LIBS ${_fontconfigCflags})
  23. IF(BUILD_OSX_BUNDLE)
  24. FIND_PATH(FONTCONFIG_INCLUDE_DIR
  25. NAMES fontconfig/fontconfig.h
  26. PATHS ${FONTCONFIG_INCLUDE_DIRS} /opt/local/include
  27. NO_DEFAULT_PATH
  28. )
  29. FIND_LIBRARY(FONTCONFIG_LIBRARY
  30. NAMES fontconfig
  31. PATHS ${FONTCONFIG_LIBRARY_DIRS} /opt/local/lib
  32. NO_DEFAULT_PATH
  33. )
  34. ELSE(BUILD_OSX_BUNDLE)
  35. FIND_PATH(FONTCONFIG_INCLUDE_DIR
  36. NAMES fontconfig/fontconfig.h
  37. PATHS ${FONTCONFIG_INCLUDE_DIRS}
  38. ${_fontconfigIncDir}
  39. /usr/include
  40. /usr/local/include
  41. PATH_SUFFIXES fontconfig
  42. )
  43. # quick hack as the above finds it nicely but our source includes the libart_lgpl text at the moment
  44. #STRING(REGEX REPLACE "/libart_lgpl" "" FONTCONFIG_INCLUDE_DIR ${FONTCONFIG_INCLUDE_DIR})
  45. FIND_LIBRARY(FONTCONFIG_LIBRARY NAMES fontconfig
  46. PATHS ${FONTCONFIG_LIBRARY_DIRS} /usr/lib /usr/local/lib
  47. )
  48. ENDIF(BUILD_OSX_BUNDLE)
  49. # MESSAGE(STATUS "fclib ${FONTCONFIG_LIBRARY}")
  50. # MESSAGE(STATUS "fcinclude ${FONTCONFIG_INCLUDE_DIR}")
  51. IF (FONTCONFIG_LIBRARY)
  52. IF (FONTCONFIG_INCLUDE_DIR)
  53. SET( FONTCONFIG_FOUND "YES" )
  54. SET( FONTCONFIG_LIBRARIES ${FONTCONFIG_LIBRARY} )
  55. FIND_PROGRAM(FONTCONFIG_CONFIG NAMES fontconfig-config PATHS ${prefix}/bin ${exec_prefix}/bin /usr/local/bin /opt/local/bin /usr/bin /usr/nekoware/bin /usr/X11/bin)
  56. # EXEC_PROGRAM(${FONTCONFIG_CONFIG} ARGS --libs OUTPUT_VARIABLE FONTCONFIG_LIBS)
  57. # EXEC_PROGRAM(${FONTCONFIG_CONFIG} ARGS --cflags OUTPUT_VARIABLE FONTCONFIG_CFLAGS)
  58. # MESSAGE(STATUS ${FONTCONFIG_LIBS})
  59. # MESSAGE(STATUS ${FONTCONFIG_CFLAGS})
  60. ENDIF (FONTCONFIG_INCLUDE_DIR)
  61. ENDIF (FONTCONFIG_LIBRARY)