use custom module for Freetype2 detection

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2016-01-27 14:45:16 +02:00
parent 39b413bcaf
commit 90f13f0196
2 changed files with 55 additions and 0 deletions

View file

@ -316,6 +316,9 @@ set_package_properties(ALSA PROPERTIES
TYPE RECOMMENDED
)
# old versions of CMake ship bogus module, always use the custom one
cmake_policy(PUSH)
cmake_policy(SET CMP0017 OLD)
find_package(Freetype)
set_package_properties(Freetype PROPERTIES
PURPOSE "Required for fonts configuration support"
@ -323,6 +326,7 @@ set_package_properties(Freetype PROPERTIES
URL "http://www.freetype.org"
TYPE RECOMMENDED
)
cmake_policy(POP)
find_package(Fontconfig)
set_package_properties(Fontconfig PROPERTIES

View file

@ -0,0 +1,51 @@
# - Try to find Freetype2
# Once done this will define
#
# FREETYPE_FOUND - system has Freetype2
# FREETYPE_INCLUDES - the Freetype2 include directory
# FREETYPE_LIBRARIES - The libraries needed to use Freetype2
#
# Copyright (c) 2015, Ivailo Monev, <xakepa10@gmail.com>
#
# Redistribution and use is allowed according to the terms of the BSD license.
if(FREETYPE_INCLUDES AND FREETYPE_LIBRARIES)
set(FREETYPE_FIND_QUIETLY TRUE)
endif()
if(NOT WIN32)
include(FindPkgConfig)
pkg_check_modules(PC_FREETYPE QUIET freetype2)
endif()
find_path(FREETYPE_INCLUDES
NAMES
freetype.h
PATH_SUFFIXES freetype2
HINTS
$ENV{FREETYPEDIR}/include
${PC_FREETYPE_INCLUDEDIR}
/usr/include
/usr/local/include
${INCLUDE_INSTALL_DIR}
)
find_library(FREETYPE_LIBRARIES
freetype
HINTS
$ENV{FREETYPEDIR}/lib
${PC_FREETYPE_LIBDIR}
/usr/lib
/usr/local/lib
${LIB_INSTALL_DIR}
)
# CMake still refers to its Freetype module, make it happy
if(FREETYPE_INCLUDES)
set(FREETYPE_INCLUDE_DIRS ${FREETYPE_INCLUDES})
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Freetype2 DEFAULT_MSG FREETYPE_INCLUDES FREETYPE_LIBRARIES)
mark_as_advanced(FREETYPE_INCLUDES FREETYPE_LIBRARIES)