summaryrefslogtreecommitdiffstats
path: root/cmake/modules/FindFreeType.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/modules/FindFreeType.cmake')
-rw-r--r--cmake/modules/FindFreeType.cmake45
1 files changed, 45 insertions, 0 deletions
diff --git a/cmake/modules/FindFreeType.cmake b/cmake/modules/FindFreeType.cmake
new file mode 100644
index 0000000..fb4c668
--- /dev/null
+++ b/cmake/modules/FindFreeType.cmake
@@ -0,0 +1,45 @@
1#.rst:
2# FindFreetype
3# ------------
4# Finds the FreeType library
5#
6# This will will define the following variables::
7#
8# FREETYPE_FOUND - system has FreeType
9# FREETYPE_INCLUDE_DIRS - the FreeType include directory
10# FREETYPE_LIBRARIES - the FreeType libraries
11#
12# and the following imported targets::
13#
14# FreeType::FreeType - The FreeType library
15
16if(PKG_CONFIG_FOUND)
17 pkg_check_modules(PC_FREETYPE freetype2 QUIET)
18endif()
19
20find_path(FREETYPE_INCLUDE_DIR NAMES freetype/freetype.h freetype.h
21 PATHS ${PC_FREETYPE_INCLUDEDIR}
22 ${PC_FREETYPE_INCLUDE_DIRS})
23find_library(FREETYPE_LIBRARY NAMES freetype freetype246MT
24 PATHS ${PC_FREETYPE_LIBDIR})
25
26set(FREETYPE_VERSION ${PC_FREETYPE_VERSION})
27
28include(FindPackageHandleStandardArgs)
29find_package_handle_standard_args(FreeType
30 REQUIRED_VARS FREETYPE_LIBRARY FREETYPE_INCLUDE_DIR
31 VERSION_VAR FREETYPE_VERSION)
32
33if(FREETYPE_FOUND)
34 set(FREETYPE_LIBRARIES ${FREETYPE_LIBRARY})
35 set(FREETYPE_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIR})
36
37 if(NOT TARGET FreeType::FreeType)
38 add_library(FreeType::FreeType UNKNOWN IMPORTED)
39 set_target_properties(FreeType::FreeType PROPERTIES
40 IMPORTED_LOCATION "${FREETYPE_LIBRARY}"
41 INTERFACE_INCLUDE_DIRECTORIES "${FREETYPE_INCLUDE_DIR}")
42 endif()
43endif()
44
45mark_as_advanced(FREETYPE_INCLUDE_DIR FREETYPE_LIBRARY)