1 # - Try to find glibmm
2 # Once done this will define
3 #
4 # GLIBMM_FOUND - system has glibmm
5 # GLIBMM_INCLUDE_DIRS - the glibmm include directory
6 # GLIBMM_LIBRARIES - Link these to use glibmm
7 # GLIBMM_DEFINITIONS - Compiler switches required for using glibmm
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 (GLIBMM_LIBRARIES AND GLIBMM_INCLUDE_DIRS)
18 # in cache already
19 set(GLIBMM_FOUND TRUE)
20 else (GLIBMM_LIBRARIES AND GLIBMM_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(glibmm-2.4 _GLIBMM_INCLUDEDIR _GLIBMM_LIBDIR _GLIBMM_LDFLAGS _GLIBMM_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(_GLIBMM glibmm-2.4)
30 endif (PKG_CONFIG_FOUND)
31 endif (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
32 find_path(GLIBMM_INCLUDE_DIR
33 NAMES
34 glibmm.h
35 PATHS
36 ${_GLIBMM_INCLUDEDIR}
37 /usr/include
38 /usr/local/include
39 /opt/local/include
40 /sw/include
41 PATH_SUFFIXES
42 glibmm-2.4
43 )
45 find_path(GLIBMM_CONFIG_INCLUDE_DIR
46 NAMES
47 glibmmconfig.h
48 PATHS
49 ${_GLIBMM_INCLUDEDIR}
50 /usr/include
51 /usr/local/include
52 /opt/local/include
53 /sw/include
54 /usr/lib/glibmm-2.4/include
55 /usr/lib64/glibmm-2.4/include
56 )
57 find_library(GLIBMM-2.4_LIBRARY
58 NAMES
59 glibmm-2.4
60 PATHS
61 ${_GLIBMM_LIBDIR}
62 /usr/lib
63 /usr/local/lib
64 /opt/local/lib
65 /sw/lib
66 )
68 if (GLIBMM-2.4_LIBRARY)
69 set(GLIBMM-2.4_FOUND TRUE)
70 endif (GLIBMM-2.4_LIBRARY)
72 set(GLIBMM_INCLUDE_DIRS
73 ${GLIBMM_INCLUDE_DIR}
74 ${GLIBMM_CONFIG_INCLUDE_DIR}
75 )
77 if (GLIBMM-2.4_FOUND)
78 set(GLIBMM_LIBRARIES
79 ${GLIBMM_LIBRARIES}
80 ${GLIBMM-2.4_LIBRARY}
81 )
82 endif (GLIBMM-2.4_FOUND)
84 if (GLIBMM_INCLUDE_DIRS AND GLIBMM_LIBRARIES)
85 set(GLIBMM_FOUND TRUE)
86 endif (GLIBMM_INCLUDE_DIRS AND GLIBMM_LIBRARIES)
88 if (GLIBMM_FOUND)
89 if (NOT glibmm_FIND_QUIETLY)
90 message(STATUS "Found glibmm: ${GLIBMM_LIBRARIES}")
91 endif (NOT glibmm_FIND_QUIETLY)
92 else (GLIBMM_FOUND)
93 if (glibmm_FIND_REQUIRED)
94 message(FATAL_ERROR "Could not find glibmm")
95 endif (glibmm_FIND_REQUIRED)
96 endif (GLIBMM_FOUND)
98 # show the GLIBMM_INCLUDE_DIRS and GLIBMM_LIBRARIES variables only in the advanced view
99 mark_as_advanced(GLIBMM_INCLUDE_DIRS GLIBMM_LIBRARIES)
101 endif (GLIBMM_LIBRARIES AND GLIBMM_INCLUDE_DIRS)