summaryrefslogtreecommitdiff
path: root/Modules/FindFreetype.cmake
diff options
context:
space:
mode:
authorbiao716.wang <biao716.wang@samsung.com>2020-03-19 01:04:30 +0900
committerbiao716.wang <biao716.wang@samsung.com>2020-03-19 01:04:30 +0900
commit1d6613f4446f69f63beddf2d97c201154fb35e33 (patch)
treef32eae75900a0df14ab8fa1e2bd436af159ef91d /Modules/FindFreetype.cmake
parentaabcd8e66e3268a232efe2e416635d5b6bf84ad5 (diff)
downloadcmake-1d6613f4446f69f63beddf2d97c201154fb35e33.tar.gz
cmake-1d6613f4446f69f63beddf2d97c201154fb35e33.tar.bz2
cmake-1d6613f4446f69f63beddf2d97c201154fb35e33.zip
Imported Upstream version 3.16.4upstream/3.16.4
Change-Id: Ic5262ea6c0872b353ea2dc35fe1e944063ae8409 Signed-off-by: biao716.wang <biao716.wang@samsung.com>
Diffstat (limited to 'Modules/FindFreetype.cmake')
-rw-r--r--Modules/FindFreetype.cmake99
1 files changed, 73 insertions, 26 deletions
diff --git a/Modules/FindFreetype.cmake b/Modules/FindFreetype.cmake
index 9ea77df1d..3e6a177dc 100644
--- a/Modules/FindFreetype.cmake
+++ b/Modules/FindFreetype.cmake
@@ -1,28 +1,46 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-#.rst:
-# FindFreetype
-# ------------
-#
-# Locate FreeType library
-#
-# This module defines
-#
-# ::
-#
-# FREETYPE_LIBRARIES, the library to link against
-# FREETYPE_FOUND, if false, do not try to link to FREETYPE
-# FREETYPE_INCLUDE_DIRS, where to find headers.
-# FREETYPE_VERSION_STRING, the version of freetype found (since CMake 2.8.8)
-# This is the concatenation of the paths:
-# FREETYPE_INCLUDE_DIR_ft2build
-# FREETYPE_INCLUDE_DIR_freetype2
-#
-#
-#
-# $FREETYPE_DIR is an environment variable that would correspond to the
-# ./configure --prefix=$FREETYPE_DIR used in building FREETYPE.
+#[=======================================================================[.rst:
+FindFreetype
+------------
+
+Find the FreeType font renderer includes and library.
+
+Imported Targets
+^^^^^^^^^^^^^^^^
+
+This module defines the following :prop_tgt:`IMPORTED` target:
+
+``Freetype::Freetype``
+ The Freetype ``freetype`` library, if found
+
+Result Variables
+^^^^^^^^^^^^^^^^
+
+This module will set the following variables in your project:
+
+``FREETYPE_FOUND``
+ true if the Freetype headers and libraries were found
+``FREETYPE_INCLUDE_DIRS``
+ directories containing the Freetype headers. This is the
+ concatenation of the variables:
+
+ ``FREETYPE_INCLUDE_DIR_ft2build``
+ directory holding the main Freetype API configuration header
+ ``FREETYPE_INCLUDE_DIR_freetype2``
+ directory holding Freetype public headers
+``FREETYPE_LIBRARIES``
+ the library to link against
+``FREETYPE_VERSION_STRING``
+ the version of freetype found (since CMake 2.8.8)
+
+Hints
+^^^^^
+
+The user may set the environment variable ``FREETYPE_DIR`` to the root
+directory of a Freetype installation.
+#]=======================================================================]
# Created by Eric Wing.
# Modifications by Alexander Neundorf.
@@ -46,10 +64,6 @@ set(FREETYPE_FIND_ARGS
HINTS
ENV FREETYPE_DIR
PATHS
- /usr/X11R6
- /usr/local/X11R6
- /usr/local/X11
- /usr/freeware
ENV GTKMM_BASEPATH
[HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]
@@ -98,6 +112,9 @@ if(NOT FREETYPE_LIBRARY)
)
include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
select_library_configurations(FREETYPE)
+else()
+ # on Windows, ensure paths are in canonical format (forward slahes):
+ file(TO_CMAKE_PATH "${FREETYPE_LIBRARY}" FREETYPE_LIBRARY)
endif()
unset(FREETYPE_FIND_ARGS)
@@ -150,3 +167,33 @@ mark_as_advanced(
FREETYPE_INCLUDE_DIR_freetype2
FREETYPE_INCLUDE_DIR_ft2build
)
+
+if(Freetype_FOUND)
+ if(NOT TARGET Freetype::Freetype)
+ add_library(Freetype::Freetype UNKNOWN IMPORTED)
+ set_target_properties(Freetype::Freetype PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${FREETYPE_INCLUDE_DIRS}")
+
+ if(FREETYPE_LIBRARY_RELEASE)
+ set_property(TARGET Freetype::Freetype APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS RELEASE)
+ set_target_properties(Freetype::Freetype PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C"
+ IMPORTED_LOCATION_RELEASE "${FREETYPE_LIBRARY_RELEASE}")
+ endif()
+
+ if(FREETYPE_LIBRARY_DEBUG)
+ set_property(TARGET Freetype::Freetype APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS DEBUG)
+ set_target_properties(Freetype::Freetype PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C"
+ IMPORTED_LOCATION_DEBUG "${FREETYPE_LIBRARY_DEBUG}")
+ endif()
+
+ if(NOT FREETYPE_LIBRARY_RELEASE AND NOT FREETYPE_LIBRARY_DEBUG)
+ set_target_properties(Freetype::Freetype PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C"
+ IMPORTED_LOCATION "${FREETYPE_LIBRARY}")
+ endif()
+ endif()
+endif()