ff7232d807bd9fb59d1621315f4c264ad183e921
1 # - Try to find GtkMM (glibmm-2.4 gdkmm-2.4 pangomm-1.4 atkmm-1.6)
2 # Where not going to find gtk+-2.0 as this is covered using FindGTK2
3 # Once done this will define
4 #
5 # GTKMM_FOUND - system has GtkMM
6 # GTKMM_INCLUDE_DIRS - the GtkMM include directory
7 # GTKMM_LIBRARIES - Link these to use GtkMM
8 # GTKMM_DEFINITIONS - Compiler switches required for using GtkMM
9 #
10 # Copyright (c) 2008 Joshua L. Blocher <verbalshadow@gmail.com>
11 #
12 # Redistribution and use is allowed according to the terms of the New
13 # BSD license.
14 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
15 #
16 SET(SubLibs
17 gtkmm-2.4
18 glibmm-2.4
19 gdkmm-2.4
20 pangomm-1.4
21 atkmm-1.6
22 )
23 \r
24 if (GTKMM_LIBRARIES AND GTKMM_INCLUDE_DIRS)
25 # in cache already
26 set(GTKMM_FOUND TRUE)
27 else (GTKMM_LIBRARIES AND GTKMM_INCLUDE_DIRS)
28 FOREACH(_SUBLIB ${SubLibs})
29 # Clean library name for header file
30 STRING(REGEX REPLACE "[-]([^ ]+)" "" _H_${_SUBLIB} "${_SUBLIB}" )
31 # use pkg-config to get the directories and then use these values
32 # in the FIND_PATH() and FIND_LIBRARY() calls
33 if (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
34 include(UsePkgConfig)
35 pkgconfig(${_SUBLIB} _${_SUBLIB}_INCLUDEDIR _${_SUBLIB}_LIBDIR _${_SUBLIB}_LDFLAGS _${_SUBLIB}_CFLAGS)
36 else (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
37 find_package(PkgConfig)
38 if (PKG_CONFIG_FOUND)
39 pkg_check_modules(_${_SUBLIB} ${_SUBLIB})
40 endif (PKG_CONFIG_FOUND)
41 endif (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
42 find_path(${_SUBLIB}_INCLUDE_DIR
43 NAMES
44 ${_H_${_SUBLIB}}.h
45 PATHS
46 ${_${_SUBLIB}_INCLUDEDIR}
47 /usr/include
48 /usr/local/include
49 /opt/local/include
50 /sw/include
51 $ENV{DEVLIBS_PATH}//include//
52 PATH_SUFFIXES
53 ${_SUBLIB}
54 )
56 find_library(${_SUBLIB}_LIBRARY
57 NAMES
58 ${_SUBLIB}
59 PATHS
60 ${_${_SUBLIB}_LIBDIR}
61 /usr/lib
62 /usr/local/lib
63 /opt/local/lib
64 /sw/lib
65 )
67 if (${_SUBLIB}_LIBRARY)
68 set(${_SUBLIB}_FOUND TRUE)
69 endif (${_SUBLIB}_LIBRARY)
71 LIST(APPEND GTKMM_INCLUDE_DIRS
72 ${${_SUBLIB}_INCLUDE_DIR}
73 )
75 if (${_SUBLIB}_FOUND)
76 LIST(APPEND GTKMM_LIBRARIES
77 ${${_SUBLIB}_LIBRARIES}
78 ${${_SUBLIB}_LIBRARY}
79 )
80 endif (${_SUBLIB}_FOUND)
81 ENDFOREACH(_SUBLIB)
83 if (GTKMM_INCLUDE_DIRS AND GTKMM_LIBRARIES)
84 set(GTKMM_FOUND TRUE)
85 endif (GTKMM_INCLUDE_DIRS AND GTKMM_LIBRARIES)
87 if (GTKMM_FOUND)
88 if (NOT GtkMM_FIND_QUIETLY)
89 message(STATUS "Found GtkMM: ${GTKMM_LIBRARIES}")
90 endif (NOT GtkMM_FIND_QUIETLY)
91 else (GTKMM_FOUND)
92 if (GtkMM_FIND_REQUIRED)
93 message(FATAL_ERROR "Could not find GtkMM")
94 endif (GtkMM_FIND_REQUIRED)
95 endif (GTKMM_FOUND)
97 # show the GTKMM_INCLUDE_DIRS and GTKMM_LIBRARIES variables only in the advanced view
98 mark_as_advanced(GTKMM_INCLUDE_DIRS GTKMM_LIBRARIES)
100 endif (GTKMM_LIBRARIES AND GTKMM_INCLUDE_DIRS)