summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-09-08 13:03:02 (GMT)
committerKitware Robot <kwrobot@kitware.com>2023-09-08 13:02:58 (GMT)
commit8aa20b554f074c79f4fab354fc0752b12847a17a (patch)
treee27cf742c875cd972bec8da5a681ea037d9f1166 /Modules
parent2c11b3a3f3ac37cd2f38a1c0181e7178710e2107 (diff)
parentd83d925045484c882527477b01596073f45d3faa (diff)
downloadCMake-8aa20b554f074c79f4fab354fc0752b12847a17a.zip
CMake-8aa20b554f074c79f4fab354fc0752b12847a17a.tar.gz
CMake-8aa20b554f074c79f4fab354fc0752b12847a17a.tar.bz2
Merge topic 'FindFreetype-use-config'
d83d925045 FindFreetype: use `freetype-config.cmake` if available Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Acked-by: Ryan Krattiger <ryan.krattiger@kitware.com> Merge-request: !8775
Diffstat (limited to 'Modules')
-rw-r--r--Modules/FindFreetype.cmake58
1 files changed, 58 insertions, 0 deletions
diff --git a/Modules/FindFreetype.cmake b/Modules/FindFreetype.cmake
index 82885cb..dcf271d 100644
--- a/Modules/FindFreetype.cmake
+++ b/Modules/FindFreetype.cmake
@@ -65,6 +65,64 @@ directory of a Freetype installation.
# I'm going to attempt to cut out the middleman and hope
# everything still works.
+set(_Freetype_args)
+if (Freetype_FIND_QUIETLY)
+ list(APPEND _Freetype_args
+ QUIET)
+endif ()
+if (Freetype_FIND_VERSION)
+ list(APPEND _Freetype_args
+ "${Freetype_FIND_VERSION}")
+ if (Freetype_FIND_VERSION_EXACT)
+ list(APPEND _Freetype_args
+ EXACT)
+ endif ()
+endif ()
+set(_Freetype_component_req)
+set(_Freetype_component_opt)
+foreach (_Freetype_component IN LISTS Freetype_FIND_COMPONENTS)
+ if (Freetype_FIND_REQUIRE_${_Freetype_component})
+ list(APPEND _Freetype_component_req
+ "${_Freetype_component}")
+ else ()
+ list(APPEND _Freetype_component_opt
+ "${_Freetype_component}")
+ endif ()
+endforeach ()
+unset(_Freetype_component)
+if (_Freetype_component_req)
+ list(APPEND _Freetype_args
+ COMPONENTS "${_Freetype_component_req}")
+endif ()
+unset(_Freetype_component_req)
+if (_Freetype_component_opt)
+ list(APPEND _Freetype_args
+ OPTIONAL_COMPONENTS "${_Freetype_component_opt}")
+endif ()
+unset(_Freetype_component_opt)
+find_package(freetype CONFIG ${_Freetype_args})
+unset(_Freetype_args)
+if (freetype_FOUND)
+ if (NOT TARGET Freetype::Freetype)
+ add_library(Freetype::Freetype IMPORTED INTERFACE)
+ set_target_properties(Freetype::Freetype PROPERTIES
+ INTERFACE_LINK_LIBRARIES freetype)
+ endif ()
+ get_property(FREETYPE_INCLUDE_DIRS TARGET freetype PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
+ get_property(FREETYPE_LIBRARIES TARGET freetype PROPERTY INTERFACE_LINK_LIBRARIES)
+ get_property(_Freetype_location TARGET freetype PROPERTY LOCATION)
+ list(APPEND FREETYPE_LIBRARIES
+ "${_Freetype_location}")
+ unset(_Freetype_location)
+ set(Freetype_FOUND 1)
+ set(FREETYPE_VERSION_STRING "${freetype_VERSION}")
+ foreach (_Freetype_component IN LISTS Freetype_FIND_COMPONENTS)
+ set(Freetype_${_Freetype_component}_FOUND "${freetype_${_Freetype_component}_FOUND}")
+ endforeach ()
+ unset(_Freetype_component)
+ return ()
+endif ()
+
set(FREETYPE_FIND_ARGS
HINTS
ENV FREETYPE_DIR