blob: 2ed605d739d4f196776168b05fbb47b01e64d7eb [file] [log] [blame]
leandro@webkit.org7bc5a632010-08-20 18:24:18 +00001# - Try to find the Fontconfig
2# Once done this will define
3#
4# FONTCONFIG_FOUND - system has Fontconfig
5# FONTCONFIG_INCLUDE_DIR - The include directory to use for the fontconfig headers
6# FONTCONFIG_LIBRARIES - Link these to use FONTCONFIG
7# FONTCONFIG_DEFINITIONS - Compiler switches required for using FONTCONFIG
8
9# Copyright (c) 2006,2007 Laurent Montel, <montel@kde.org>
10#
11# Redistribution and use in source and binary forms, with or without
12# modification, are permitted provided that the following conditions
13# are met:
14#
15# 1. Redistributions of source code must retain the copyright
16# notice, this list of conditions and the following disclaimer.
17# 2. Redistributions in binary form must reproduce the copyright
18# notice, this list of conditions and the following disclaimer in the
19# documentation and/or other materials provided with the distribution.
commit-queue@webkit.orgd6fb2c52012-12-06 03:10:13 +000020# 3. The name of the author may not be used to endorse or promote products
leandro@webkit.org7bc5a632010-08-20 18:24:18 +000021# derived from this software without specific prior written permission.
22#
23# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
24# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
25# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
27# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
28# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
32# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33#
34
35if (FONTCONFIG_LIBRARIES AND FONTCONFIG_INCLUDE_DIR)
36
commit-queue@webkit.orgd6fb2c52012-12-06 03:10:13 +000037 # in cache already
38 set(FONTCONFIG_FOUND TRUE)
leandro@webkit.org7bc5a632010-08-20 18:24:18 +000039
40else (FONTCONFIG_LIBRARIES AND FONTCONFIG_INCLUDE_DIR)
41
commit-queue@webkit.orgd6fb2c52012-12-06 03:10:13 +000042 if (NOT WIN32)
43 # use pkg-config to get the directories and then use these values
44 # in the find_path() and find_library() calls
45 find_package(PkgConfig)
46 pkg_check_modules(PC_FONTCONFIG fontconfig)
leandro@webkit.org7bc5a632010-08-20 18:24:18 +000047
commit-queue@webkit.orgd6fb2c52012-12-06 03:10:13 +000048 set(FONTCONFIG_DEFINITIONS ${PC_FONTCONFIG_CFLAGS_OTHER})
49 endif (NOT WIN32)
leandro@webkit.org7bc5a632010-08-20 18:24:18 +000050
commit-queue@webkit.orgd6fb2c52012-12-06 03:10:13 +000051 find_path(FONTCONFIG_INCLUDE_DIR fontconfig/fontconfig.h
52 PATHS
53 ${PC_FONTCONFIG_INCLUDEDIR}
54 ${PC_FONTCONFIG_INCLUDE_DIRS}
55 /usr/X11/include
56 )
leandro@webkit.org7bc5a632010-08-20 18:24:18 +000057
commit-queue@webkit.orgd6fb2c52012-12-06 03:10:13 +000058 find_library(FONTCONFIG_LIBRARIES NAMES fontconfig
59 PATHS
60 ${PC_FONTCONFIG_LIBDIR}
61 ${PC_FONTCONFIG_LIBRARY_DIRS}
62 )
leandro@webkit.org7bc5a632010-08-20 18:24:18 +000063
commit-queue@webkit.orgd6fb2c52012-12-06 03:10:13 +000064 include(FindPackageHandleStandardArgs)
65 FIND_PACKAGE_HANDLE_STANDARD_ARGS(Fontconfig DEFAULT_MSG FONTCONFIG_LIBRARIES FONTCONFIG_INCLUDE_DIR)
66
67 mark_as_advanced(FONTCONFIG_LIBRARIES FONTCONFIG_INCLUDE_DIR)
leandro@webkit.org7bc5a632010-08-20 18:24:18 +000068
69endif (FONTCONFIG_LIBRARIES AND FONTCONFIG_INCLUDE_DIR)