From 8cdf8dec703d882b46ca50a769fabb95ffc48e2c Mon Sep 17 00:00:00 2001 From: manuel Date: Thu, 24 Nov 2016 21:27:41 +0100 Subject: sync with upstream --- project/cmake/modules/FindFreeType.cmake | 49 +++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 11 deletions(-) (limited to 'project/cmake/modules/FindFreeType.cmake') diff --git a/project/cmake/modules/FindFreeType.cmake b/project/cmake/modules/FindFreeType.cmake index a1e69ab..fb4c668 100644 --- a/project/cmake/modules/FindFreeType.cmake +++ b/project/cmake/modules/FindFreeType.cmake @@ -1,18 +1,45 @@ -# - Try to find freetype -# Once done this will define +#.rst: +# FindFreetype +# ------------ +# Finds the FreeType library # -# FREETYPE_FOUND - system has freetype -# FREETYPE_INCLUDE_DIRS - the freetype include directory -# FREETYPE_LIBRARIES - The freetype libraries +# This will will define the following variables:: +# +# FREETYPE_FOUND - system has FreeType +# FREETYPE_INCLUDE_DIRS - the FreeType include directory +# FREETYPE_LIBRARIES - the FreeType libraries +# +# and the following imported targets:: +# +# FreeType::FreeType - The FreeType library if(PKG_CONFIG_FOUND) - pkg_check_modules (FREETYPE freetype2) -else() - find_path(FREETYPE_INCLUDE_DIRS freetype/freetype.h) - find_library(FREETYPE_LIBRARIES NAMES freetype freetype246MT) + pkg_check_modules(PC_FREETYPE freetype2 QUIET) endif() +find_path(FREETYPE_INCLUDE_DIR NAMES freetype/freetype.h freetype.h + PATHS ${PC_FREETYPE_INCLUDEDIR} + ${PC_FREETYPE_INCLUDE_DIRS}) +find_library(FREETYPE_LIBRARY NAMES freetype freetype246MT + PATHS ${PC_FREETYPE_LIBDIR}) + +set(FREETYPE_VERSION ${PC_FREETYPE_VERSION}) + include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(FreeType DEFAULT_MSG FREETYPE_INCLUDE_DIRS FREETYPE_LIBRARIES) +find_package_handle_standard_args(FreeType + REQUIRED_VARS FREETYPE_LIBRARY FREETYPE_INCLUDE_DIR + VERSION_VAR FREETYPE_VERSION) + +if(FREETYPE_FOUND) + set(FREETYPE_LIBRARIES ${FREETYPE_LIBRARY}) + set(FREETYPE_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIR}) + + if(NOT TARGET FreeType::FreeType) + add_library(FreeType::FreeType UNKNOWN IMPORTED) + set_target_properties(FreeType::FreeType PROPERTIES + IMPORTED_LOCATION "${FREETYPE_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${FREETYPE_INCLUDE_DIR}") + endif() +endif() -mark_as_advanced(FREETYPE_INCLUDE_DIRS FREETYPE_LIBRARIES) +mark_as_advanced(FREETYPE_INCLUDE_DIR FREETYPE_LIBRARY) -- cgit v1.2.3