1 # Distributed under the OSI-approved BSD 3-Clause License. See accompanying 2 # file Copyright.txt or https://cmake.org/licensing for details. 4 # XXX: Copied from CMake, but includes vtkDetectLibraryType. 5 # See https://gitlab.kitware.com/cmake/cmake/-/issues/18564 7 #[=======================================================================[.rst: 11 Find the FreeType font renderer includes and library.
16 This module defines the following :prop_tgt:`IMPORTED`
target:
18 ``Freetype::Freetype``
19 The Freetype ``freetype`` library,
if found
24 This module will
set the following variables in your project:
27 true if the Freetype headers and libraries were found
28 ``FREETYPE_INCLUDE_DIRS``
29 directories containing the Freetype headers. This is the
30 concatenation of the variables:
32 ``FREETYPE_INCLUDE_DIR_ft2build``
33 directory holding the main Freetype API configuration header
34 ``FREETYPE_INCLUDE_DIR_freetype2``
35 directory holding Freetype
public headers
36 ``FREETYPE_LIBRARIES``
37 the library to link against
38 ``FREETYPE_VERSION_STRING``
39 the
version of freetype found (since CMake 2.8.8)
44 The user may
set the environment variable ``FREETYPE_DIR`` to the root
45 directory of a Freetype installation.
46 #]=======================================================================]
48 # Created by Eric Wing. 49 # Modifications by Alexander Neundorf. 50 # This file has been renamed to "FindFreetype.cmake" instead of the correct 51 # "FindFreeType.cmake" in order to be compatible with the one from KDE4, Alex. 53 # Ugh, FreeType seems to use some #include trickery which 54 # makes this harder than it should be. It looks like they 55 # put ft2build.h in a common/easier-to-find location which 56 # then contains a #include to a more specific header in a 57 # more specific location (#include <freetype/config/ftheader.h>). 58 # Then from there, they need to set a bunch of #define's 59 # so you can do something like: 60 # #include FT_FREETYPE_H 61 # Unfortunately, using CMake's mechanisms like include_directories() 62 # wants explicit full paths and this trickery doesn't work too well. 63 # I'm going to attempt to cut out the middleman and hope 64 # everything still works. 66 set(FREETYPE_FIND_ARGS
71 [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]
72 [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]
76 FREETYPE_INCLUDE_DIR_ft2build
86 FREETYPE_INCLUDE_DIR_freetype2
88 freetype/config/ftheader.h
97 if(NOT FREETYPE_LIBRARY)
98 find_library(FREETYPE_LIBRARY_RELEASE
103 ${FREETYPE_FIND_ARGS}
107 find_library(FREETYPE_LIBRARY_DEBUG
112 ${FREETYPE_FIND_ARGS}
116 include(SelectLibraryConfigurations)
117 select_library_configurations(FREETYPE)
119 # on Windows, ensure paths are in canonical format (forward slahes): 120 file(TO_CMAKE_PATH
"${FREETYPE_LIBRARY}" FREETYPE_LIBRARY)
123 unset(FREETYPE_FIND_ARGS)
125 # set the user variables 126 if(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2)
127 set(FREETYPE_INCLUDE_DIRS
"${FREETYPE_INCLUDE_DIR_ft2build};${FREETYPE_INCLUDE_DIR_freetype2}")
128 list(REMOVE_DUPLICATES FREETYPE_INCLUDE_DIRS)
130 set(FREETYPE_LIBRARIES "${FREETYPE_LIBRARY}
") 132 if(EXISTS "${FREETYPE_INCLUDE_DIR_freetype2}/freetype/freetype.h
") 133 set(FREETYPE_H "${FREETYPE_INCLUDE_DIR_freetype2}/freetype/freetype.h
") 134 elseif(EXISTS "${FREETYPE_INCLUDE_DIR_freetype2}/freetype.h
") 135 set(FREETYPE_H "${FREETYPE_INCLUDE_DIR_freetype2}/freetype.h
") 138 if(FREETYPE_INCLUDE_DIR_freetype2 AND FREETYPE_H) 139 file(STRINGS "${FREETYPE_H}
" freetype_version_str 140 REGEX "^#[\t ]*define[\t ]+FREETYPE_(MAJOR|MINOR|PATCH)[\t ]+[0-9]+$
") 142 unset(FREETYPE_VERSION_STRING) 143 foreach(VPART MAJOR MINOR PATCH) 144 foreach(VLINE ${freetype_version_str}) 145 if(VLINE MATCHES "^#[\t ]*define[\t ]+FREETYPE_${VPART}[\t ]+([0-9]+)$
") 146 set(FREETYPE_VERSION_PART "${CMAKE_MATCH_1}
") 147 if(FREETYPE_VERSION_STRING) 148 string(APPEND FREETYPE_VERSION_STRING ".${FREETYPE_VERSION_PART}
") 150 set(FREETYPE_VERSION_STRING "${FREETYPE_VERSION_PART}
") 152 unset(FREETYPE_VERSION_PART) 158 include(FindPackageHandleStandardArgs) 160 find_package_handle_standard_args( 164 FREETYPE_INCLUDE_DIRS 166 FREETYPE_VERSION_STRING 170 FREETYPE_INCLUDE_DIR_freetype2 171 FREETYPE_INCLUDE_DIR_ft2build 175 if(NOT TARGET Freetype::Freetype) 176 include(vtkDetectLibraryType) 177 set(freetype_library_type UNKNOWN) 178 if (FREETYPE_LIBRARY_RELEASE) 179 vtk_detect_library_type(freetype_release_library_type 180 PATH "${FREETYPE_LIBRARY_RELEASE}
") 182 if (FREETYPE_LIBRARY_DEBUG) 183 vtk_detect_library_type(freetype_debug_library_type 184 PATH "${FREETYPE_LIBRARY_DEBUG}
") 186 if (freetype_release_library_type AND freetype_debug_library_type) 187 if (freetype_release_library_type STREQUAL freetype_debug_library_type) 188 set(freetype_library_type "${freetype_release_library_type}
") 190 elseif (freetype_release_library_type) 191 set(freetype_library_type "${freetype_release_library_type}
") 192 elseif (freetype_debug_library_type) 193 set(freetype_library_type "${freetype_debug_library_type}
") 195 add_library(Freetype::Freetype "${freetype_library_type}
" IMPORTED) 196 unset(freetype_release_library_type) 197 unset(freetype_debug_library_type) 198 unset(freetype_library_type) 199 set_target_properties(Freetype::Freetype PROPERTIES 200 INTERFACE_INCLUDE_DIRECTORIES "${FREETYPE_INCLUDE_DIRS}
") 202 if(FREETYPE_LIBRARY_RELEASE) 203 set_property(TARGET Freetype::Freetype APPEND PROPERTY 204 IMPORTED_CONFIGURATIONS RELEASE) 205 set_target_properties(Freetype::Freetype PROPERTIES 206 IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C
" 207 IMPORTED_LOCATION_RELEASE "${FREETYPE_LIBRARY_RELEASE}
" 208 IMPORTED_IMPLIB_RELEASE "${FREETYPE_LIBRARY_RELEASE}
") 211 if(FREETYPE_LIBRARY_DEBUG) 212 set_property(TARGET Freetype::Freetype APPEND PROPERTY 213 IMPORTED_CONFIGURATIONS DEBUG) 214 set_target_properties(Freetype::Freetype PROPERTIES 215 IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C
" 216 IMPORTED_LOCATION_DEBUG "${FREETYPE_LIBRARY_DEBUG}
" 217 IMPORTED_IMPLIB_DEBUG "${FREETYPE_LIBRARY_DEBUG}
") 220 if(NOT FREETYPE_LIBRARY_RELEASE AND NOT FREETYPE_LIBRARY_DEBUG) 221 set_target_properties(Freetype::Freetype PROPERTIES 222 IMPORTED_LINK_INTERFACE_LANGUAGES "C
" 223 IMPORTED_LOCATION "${FREETYPE_LIBRARY}
" 224 IMPORTED_IMPLIB "${FREETYPE_LIBRARY}
") boost::graph_traits< vtkGraph *>::vertex_descriptor target(boost::graph_traits< vtkGraph *>::edge_descriptor e, vtkGraph *)