FindFontConfig.cmake 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # - Find FontConfig library
  2. # Find the FontConfig includes and library
  3. # This module defines
  4. # FONTCONFIG_INCLUDE_DIR, where to find fontconfig.h
  5. # FONTCONFIG_LIBRARIES, libraries to link against to use the FontConfig API.
  6. # FONTCONFIG_FOUND, If false, do not try to use FontConfig.
  7. #=============================================================================
  8. # Copyright 2012 Kitware, Inc.
  9. #
  10. # Distributed under the OSI-approved BSD License (the "License");
  11. # see accompanying file Copyright.txt for details.
  12. #
  13. # This software is distributed WITHOUT ANY WARRANTY; without even the
  14. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  15. # See the License for more information.
  16. #=============================================================================
  17. # (To distribute this file outside of VTK, substitute the full
  18. # License text for the above reference.)
  19. find_path(FONTCONFIG_INCLUDE_DIR fontconfig/fontconfig.h)
  20. find_library(FONTCONFIG_LIBRARY NAMES fontconfig)
  21. # handle the QUIETLY and REQUIRED arguments and set FONTCONFIG_FOUND to TRUE if
  22. # all listed variables are TRUE
  23. include(FindPackageHandleStandardArgs)
  24. find_package_handle_standard_args(FontConfig DEFAULT_MSG
  25. FONTCONFIG_LIBRARY FONTCONFIG_INCLUDE_DIR)
  26. if(FONTCONFIG_FOUND)
  27. if (NOT TARGET FontConfig::FontConfig)
  28. add_library(FontConfig::FontConfig UNKNOWN IMPORTED)
  29. set_target_properties(FontConfig::FontConfig PROPERTIES
  30. IMPORTED_LOCATION "${FONTCONFIG_LIBRARY}"
  31. INTERFACE_INCLUDE_DIRECTORIES "${FONTCONFIG_INCLUDE_DIR}")
  32. endif ()
  33. set( FONTCONFIG_LIBRARIES ${FONTCONFIG_LIBRARY} )
  34. endif()
  35. mark_as_advanced(FONTCONFIG_INCLUDE_DIR FONTCONFIG_LIBRARY FONTCONFIG_LIBRARIES)