2 # This file is part of the aMule Project.
4 # Copyright (c) 2011 Werner Mahr (Vollstrecker) <amule@vollstreckernet.de>
6 # Any parts of this program contributed by third-party developers are copyrighted
7 # by their respective authors.
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 3 of the License, or
12 # (at your option) any later version.
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write to the Free Software
21 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 # This file uses the following variables:
26 # MIN_GDLIB_VERSION -- to check if gdlib is available in a recent
27 # version for usage in your project. If MIN_GDLIB_VERSION was
28 # not set, no version-check is done.
30 # This file defines the folling variables
32 # gdlib_FOUND -- TRUE if gdlib was found, and if version-check is done
33 # if it is new enough, otherwise FALSE
35 # gdlib_CONFIG_EXECUTABLE -- Contains the complete path to gdlib-config
38 # gdlib_VERSION -- If version-check is done, the version goes here
40 # gdlib_LIB_DIR -- libdir reportet by gdlib-config
42 # gdlib_INCLUDE_DIR -- include-dir reportet by gdlib-config
44 # gdlib_LD_FLAGS -- ldflags reportet by gdlib-config
46 # gdlib_LIBS -- libs reportet by gdlib-config
48 # gdlib_CFLAGS -- cflags reportet by gdlib-config
53 find_package (PkgConfig REQUIRED)
54 pkg_search_module (gdlib REQUIRED gdlib)
55 message (STATUS "gdlib version: ${gdlib_VERSION} -- OK")
59 find_program (gdlib_CONFIG_EXECUTABLE gdlib-config
60 ONLY_CMAKE_FIND_ROOT_PATH
63 if (gdlib_CONFIG_EXECUTABLE)
64 execute_process (COMMAND ${gdlib_CONFIG_EXECUTABLE} --version
65 OUTPUT_VARIABLE gdlib_VERSION
68 string (REGEX REPLACE "(\r?\n)+$" "" gdlib_VERSION "${gdlib_VERSION}")
70 if (${gdlib_VERSION} VERSION_LESS ${MIN_GDLIB_VERSION})
71 message (FATAL_ERROR "gdlib version ${gdlib_VERSION} -- too old")
73 message (STATUS "gdlib version ${gdlib_VERSION} -- OK")
74 set (gdlib_FOUND TRUE)
76 execute_process (COMMAND ${gdlib_CONFIG_EXECUTABLE} --libdir
77 OUTPUT_VARIABLE gdlib_LIB_DIR
80 execute_process (COMMAND ${gdlib_CONFIG_EXECUTABLE} --includedir
81 OUTPUT_VARIABLE gdlib_INCLUDE_DIR
84 execute_process (COMMAND ${gdlib_CONFIG_EXECUTABLE} --ldflags
85 OUTPUT_VARIABLE gdlib_LDFLAGS
88 execute_process (COMMAND ${gdlib_CONFIG_EXECUTABLE} --libs
89 OUTPUT_VARIABLE gdlib_LIBRARIES
92 execute_process (COMMAND ${gdlib_CONFIG_EXECUTABLE} --cflags
93 OUTPUT_VARIABLE gdlib_CFLAGS
100 set (gdlib_CFLAGS "${gdlib_CFLAGS} __GD__")