Code

Cmake: more fixes plus a patch for OSX paths by Henrik Gustafsson
[inkscape.git] / CMakeScripts / FindGIOMM.cmake
1 # - Try to find GIOMM
2 # Once done this will define
3 #
4 #  GIOMM_FOUND - system has GIOMM
5 #  GIOMM_INCLUDE_DIRS - the GIOMM include directory
6 #  GIOMM_LIBRARIES - Link these to use GIOMM
7 #  GIOMM_DEFINITIONS - Compiler switches required for using GIOMM
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 (GIOMM_LIBRARIES AND GIOMM_INCLUDE_DIRS)
18   # in cache already
19   set(GIOMM_FOUND TRUE)
20 else (GIOMM_LIBRARIES AND GIOMM_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(giomm-2.4 _GIOMM_INCLUDEDIR _GIOMM_LIBDIR _GIOMM_LDFLAGS _GIOMM_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(_GIOMM giomm-2.4)
30     endif (PKG_CONFIG_FOUND)
31   endif (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
32   find_path(GIOMM_INCLUDE_DIR
33     NAMES
34       giomm.h
35     PATHS
36       ${_GIOMM_INCLUDEDIR}
37       /usr/include
38       /usr/local/include
39       /opt/local/include
40       /opt/local/include/giomm-2.4/
41       /sw/include
42     PATH_SUFFIXES
43       giomm-2.4
44   )
46   find_library(GIOMM-2.4_LIBRARY
47     NAMES
48       giomm-2.4
49     PATHS
50       ${_GIOMM_LIBDIR}
51       /usr/lib
52       /usr/local/lib
53       /opt/local/lib
54       /sw/lib
55   )
57   if (GIOMM-2.4_LIBRARY)
58     set(GIOMM-2.4_FOUND TRUE)
59   endif (GIOMM-2.4_LIBRARY)
61   set(GIOMM_INCLUDE_DIRS
62     ${GIOMM_INCLUDE_DIR}
63   )
65   if (GIOMM-2.4_FOUND)
66     set(GIOMM_LIBRARIES
67       ${GIOMM_LIBRARIES}
68       ${GIOMM-2.4_LIBRARY}
69     )
70   endif (GIOMM-2.4_FOUND)
72   if (GIOMM_INCLUDE_DIRS AND GIOMM_LIBRARIES)
73      set(GIOMM_FOUND TRUE)
74   endif (GIOMM_INCLUDE_DIRS AND GIOMM_LIBRARIES)
76   if (GIOMM_FOUND)
77     if (NOT GIOMM_FIND_QUIETLY)
78       message(STATUS "Found GIOMM: ${GIOMM_LIBRARIES}")
79     endif (NOT GIOMM_FIND_QUIETLY)
80   else (GIOMM_FOUND)
81     if (GIOMM_FIND_REQUIRED)
82       message(FATAL_ERROR "Could not find GIOMM")
83     endif (GIOMM_FIND_REQUIRED)
84   endif (GIOMM_FOUND)
86   # show the GIOMM_INCLUDE_DIRS and GIOMM_LIBRARIES variables only in the advanced view
87   mark_as_advanced(GIOMM_INCLUDE_DIRS GIOMM_LIBRARIES)
89 endif (GIOMM_LIBRARIES AND GIOMM_INCLUDE_DIRS)