Code

Cmake: Add GSL to LIBS and Includes
[inkscape.git] / CMakeScripts / FindGDKMM.cmake
1 # - Try to find GDKMM
2 # Once done this will define
3 #
4 #  GDKMM_FOUND - system has GDKMM
5 #  GDKMM_INCLUDE_DIRS - the GDKMM include directory
6 #  GDKMM_LIBRARIES - Link these to use GDKMM
7 #  GDKMM_DEFINITIONS - Compiler switches required for using GDKMM
8 #
9 #  Copyright (c) 2008 Joshua L. Blocher <verbalshadow@gmail.com>
10 #
11 #  Redistribution and use is allowed according to the terms of the New
12 #  BSD license.
13 #  For details see the accompanying COPYING-CMAKE-SCRIPTS file.
14 #
17 if (GDKMM_LIBRARIES AND GDKMM_INCLUDE_DIRS)
18   # in cache already
19   set(GDKMM_FOUND TRUE)
20 else (GDKMM_LIBRARIES AND GDKMM_INCLUDE_DIRS)
21   # use pkg-config to get the directories and then use these values
22   # in the FIND_PATH() and FIND_LIBRARY() calls
23   if (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
24     include(UsePkgConfig)
25     pkgconfig(gdkmm-2.4 _GDKMM_INCLUDEDIR _GDKMM_LIBDIR _GDKMM_LDFLAGS _GDKMM_CFLAGS)
26   else (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
27     find_package(PkgConfig)
28     if (PKG_CONFIG_FOUND)
29       pkg_check_modules(_GDKMM gdkmm-2.4)
30     endif (PKG_CONFIG_FOUND)
31   endif (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
32   find_path(GDKMM_INCLUDE_DIR
33     NAMES
34       gdkmm.h
35     PATHS
36       ${_GDKMM_INCLUDEDIR}
37       /usr/include
38       /usr/local/include
39       /opt/local/include
40       /sw/include
41     PATH_SUFFIXES
42       gdkmm-2.4
43   )
45   find_path(GDKMM_CONFIG_INCLUDE_DIR
46     NAMES
47       gdkmmconfig.h
48     PATHS
49       ${_GDKMM_INCLUDEDIR}
50       /usr/include
51       /usr/local/include
52       /opt/local/include
53       /sw/include
54       /usr/lib/gdkmm-2.4/include
55       /usr/lib64/gdkmm-2.4/include
56   )
57   
58   find_library(GDKMM-2.4_LIBRARY
59     NAMES
60       gdkmm-2.4
61     PATHS
62       ${_GDKMM_LIBDIR}
63       /usr/lib
64       /usr/local/lib
65       /opt/local/lib
66       /sw/lib
67   )
69   if (GDKMM-2.4_LIBRARY)
70     set(GDKMM-2.4_FOUND TRUE)
71   endif (GDKMM-2.4_LIBRARY)
73   set(GDKMM_INCLUDE_DIRS
74     ${GDKMM_INCLUDE_DIR}
75     ${GDKMM_CONFIG_INCLUDE_DIR}
76   )
78   if (GDKMM-2.4_FOUND)
79     set(GDKMM_LIBRARIES
80       ${GDKMM_LIBRARIES}
81       ${GDKMM-2.4_LIBRARY}
82     )
83   endif (GDKMM-2.4_FOUND)
85   if (GDKMM_INCLUDE_DIRS AND GDKMM_LIBRARIES)
86      set(GDKMM_FOUND TRUE)
87   endif (GDKMM_INCLUDE_DIRS AND GDKMM_LIBRARIES)
89   if (GDKMM_FOUND)
90     if (NOT GDKMM_FIND_QUIETLY)
91       message(STATUS "Found GDKMM: ${GDKMM_LIBRARIES}")
92     endif (NOT GDKMM_FIND_QUIETLY)
93   else (GDKMM_FOUND)
94     if (GDKMM_FIND_REQUIRED)
95       message(FATAL_ERROR "Could not find GDKMM")
96     endif (GDKMM_FIND_REQUIRED)
97   endif (GDKMM_FOUND)
99   # show the GDKMM_INCLUDE_DIRS and GDKMM_LIBRARIES variables only in the advanced view
100   mark_as_advanced(GDKMM_INCLUDE_DIRS GDKMM_LIBRARIES)
102 endif (GDKMM_LIBRARIES AND GDKMM_INCLUDE_DIRS)