Code

Cmake: More Dependency work, added new files
[inkscape.git] / CMakeScripts / FindSigC++.cmake
1 # - Try to find SIGC++
2 # Once done this will define
3 #
4 #  SIGC++_FOUND - system has SIGC++
5 #  SIGC++_INCLUDE_DIRS - the SIGC++ include directory
6 #  SIGC++_LIBRARIES - Link these to use SIGC++
7 #  SIGC++_DEFINITIONS - Compiler switches required for using SIGC++
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 (SIGC++_LIBRARIES AND SIGC++_INCLUDE_DIRS)
18   # in cache already
19   set(SIGC++_FOUND TRUE)
20 else (SIGC++_LIBRARIES AND SIGC++_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(sigc++-2.0 _SIGC++_INCLUDEDIR _SIGC++_LIBDIR _SIGC++_LDFLAGS _SIGC++_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(_SIGC++ sigc++-2.0)
30     endif (PKG_CONFIG_FOUND)
31   endif (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
32   find_path(SIGC++_INCLUDE_DIR
33     NAMES
34       sigc++/sigc++.h
35     PATHS
36       ${_SIGC++_INCLUDEDIR}
37       /usr/include
38       /usr/local/include
39       /opt/local/include
40       /sw/include
41     PATH_SUFFIXES
42       sigc++-2.0
43   )
45   find_library(SIGC-2.0_LIBRARY
46     NAMES
47       sigc-2.0
48     PATHS
49       ${_SIGC++_LIBDIR}
50       /usr/lib
51       /usr/local/lib
52       /opt/local/lib
53       /sw/lib
54   )
56   if (SIGC-2.0_LIBRARY)
57     set(SIGC-2.0_FOUND TRUE)
58   endif (SIGC-2.0_LIBRARY)
60   set(SIGC++_INCLUDE_DIRS
61     ${SIGC++_INCLUDE_DIR}
62   )
64   if (SIGC-2.0_FOUND)
65     set(SIGC++_LIBRARIES
66       ${SIGC++_LIBRARIES}
67       ${SIGC-2.0_LIBRARY}
68     )
69   endif (SIGC-2.0_FOUND)
71   if (SIGC++_INCLUDE_DIRS AND SIGC++_LIBRARIES)
72      set(SIGC++_FOUND TRUE)
73   endif (SIGC++_INCLUDE_DIRS AND SIGC++_LIBRARIES)
75   if (SIGC++_FOUND)
76     if (NOT SIGC++_FIND_QUIETLY)
77       message(STATUS "Found SIGC++: ${SIGC++_LIBRARIES}")
78     endif (NOT SIGC++_FIND_QUIETLY)
79   else (SIGC++_FOUND)
80     if (SIGC++_FIND_REQUIRED)
81       message(FATAL_ERROR "Could not find SIGC++")
82     endif (SIGC++_FIND_REQUIRED)
83   endif (SIGC++_FOUND)
85   # show the SIGC++_INCLUDE_DIRS and SIGC++_LIBRARIES variables only in the advanced view
86   mark_as_advanced(SIGC++_INCLUDE_DIRS SIGC++_LIBRARIES)
88 endif (SIGC++_LIBRARIES AND SIGC++_INCLUDE_DIRS)