aboutsummaryrefslogtreecommitdiff
path: root/CMake
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2018-03-21 16:53:31 +0100
committerThomas White <taw@physics.org>2018-03-21 17:01:13 +0100
commit018bff49cd1f5fbd3071b092d0546be67147e893 (patch)
tree585b3a54bd37b9bb7a7a23c32cde42d0909732df /CMake
parent0b849787cd825f5d4e5b16f1e64552ecb10d0b76 (diff)
Separate tests for gdk-pixbuf-2.0 and GDK
Diffstat (limited to 'CMake')
-rw-r--r--CMake/FindGDK.cmake51
-rw-r--r--CMake/FindGdkPixbuf2.cmake51
2 files changed, 102 insertions, 0 deletions
diff --git a/CMake/FindGDK.cmake b/CMake/FindGDK.cmake
new file mode 100644
index 00000000..5de42303
--- /dev/null
+++ b/CMake/FindGDK.cmake
@@ -0,0 +1,51 @@
+# - Try to find the GDK library
+# Once done this will define
+#
+# GDK_FOUND - system has gdk
+# GDK_INCLUDE_DIRS - the gdk include directory
+# GDK_LIBRARIES - Link these to use gdk
+#
+# Define GDK_MIN_VERSION for which version desired.
+#
+
+include(FindPkgConfig)
+
+if (GDK_FIND_REQUIRED)
+ set(_pkgconfig_REQUIRED "REQUIRED")
+else (GDK_FIND_REQUIRED)
+ set(_pkgconfig_REQUIRED "")
+endif (GDK_FIND_REQUIRED)
+
+if (GDK_MIN_VERSION)
+ pkg_search_module(GDK ${_pkgconfig_REQUIRED} gdk-2.0>=${GDK_MIN_VERSION})
+else (GDK_MIN_VERSION)
+ pkg_search_module(GDK ${_pkgconfig_REQUIRED} gdk-2.0)
+endif (GDK_MIN_VERSION)
+
+if (GDK_FOUND)
+ message(STATUS "Found GDK (using pkg-config): ${GDK_LIBRARIES}")
+endif (GDK_FOUND)
+
+# Backup option if we don't have pkg-config
+if (NOT GDK_FOUND AND NOT PKG_CONFIG_FOUND)
+
+ find_path(GDK_INCLUDE_DIRS gdk/gdk.h)
+ find_library(GDK_LIBRARIES gdk)
+
+ if (GDK_LIBRARIES AND GDK_INCLUDE_DIRS)
+ set(GDK_FOUND 1)
+ if (NOT GDK_FIND_QUIETLY)
+ message(STATUS "Found GDK_LIBRARIES}")
+ endif(NOT GDK_FIND_QUIETLY)
+ else (GDK_LIBRARIES AND GDK_INCLUDE_DIRS)
+ if (GDK_FIND_REQUIRED)
+ message(SEND_ERROR "Could not find GDK")
+ else (GDK_FIND_REQUIRED)
+ if (NOT GDK_FIND_QUIETLY)
+ message(STATUS "Could not find GDK")
+ endif (NOT GDK_FIND_QUIETLY)
+ endif (GDK_FIND_REQUIRED)
+ endif (GDK_LIBRARIES AND GDK_INCLUDE_DIRS)
+
+endif (NOT GDK_FOUND AND NOT PKG_CONFIG_FOUND)
+
diff --git a/CMake/FindGdkPixbuf2.cmake b/CMake/FindGdkPixbuf2.cmake
new file mode 100644
index 00000000..dea84f4e
--- /dev/null
+++ b/CMake/FindGdkPixbuf2.cmake
@@ -0,0 +1,51 @@
+# - Try to find the gdk-pixbuf-2.0 library
+# Once done this will define
+#
+# GDKPIXBUF_FOUND - system has gdk-pixbuf
+# GDKPIXBUF_INCLUDE_DIRS - the gdk-pixbuf include directory
+# GDKPIXBUF_LIBRARIES - Link these to use gdk-pixbuf
+#
+# Define GDKPIXBUF_MIN_VERSION for which version desired.
+#
+
+include(FindPkgConfig)
+
+if (GdkPixbuf2_FIND_REQUIRED)
+ set(_pkgconfig_REQUIRED "REQUIRED")
+else (GdkPixbuf2_FIND_REQUIRED)
+ set(_pkgconfig_REQUIRED "")
+endif (GdkPixbuf2_FIND_REQUIRED)
+
+if (GDKPIXBUF_MIN_VERSION)
+ pkg_search_module(GDKPIXBUF ${_pkgconfig_REQUIRED} gdk-pixbuf-2.0>=${GDKPIXBUF_MIN_VERSION})
+else (GDKPIXBUF_MIN_VERSION)
+ pkg_search_module(GDKPIXBUF ${_pkgconfig_REQUIRED} gdk-pixbuf-2.0)
+endif (GDKPIXBUF_MIN_VERSION)
+
+if (GDKPIXBUF_FOUND)
+ message(STATUS "Found GdkPixbuf2 (using pkg-config): ${GDKPIXBUF_LIBRARIES}")
+endif (GDKPIXBUF_FOUND)
+
+# Backup option if we don't have pkg-config
+if (NOT GDKPIXBUF_FOUND AND NOT PKG_CONFIG_FOUND)
+
+ find_path(GDKPIXBUF_INCLUDE_DIRS gdk-pixbuf/gdk-pixbuf.h)
+ find_library(GDKPIXBUF_LIBRARIES gdk-pixbuf)
+
+ if (GDKPIXBUF_LIBRARIES AND GDKPIXBUF_INCLUDE_DIRS)
+ set(GDKPIXBUF_FOUND 1)
+ if (NOT GdkPixbuf2_FIND_QUIETLY)
+ message(STATUS "Found GdkPixbuf2: ${GDKPIXBUF_LIBRARIES}")
+ endif(NOT GdkPixbuf2_FIND_QUIETLY)
+ else (GDKPIXBUF_LIBRARIES AND GDKPIXBUF_INCLUDE_DIRS)
+ if (GdkPixbuf2_FIND_REQUIRED)
+ message(SEND_ERROR "Could not find GdkPixbuf2")
+ else (GdkPixbuf2_FIND_REQUIRED)
+ if (NOT GdkPixbuf2_FIND_QUIETLY)
+ message(STATUS "Could not find GdkPixbuf2")
+ endif (NOT GdkPixbuf2_FIND_QUIETLY)
+ endif (GdkPixbuf2_FIND_REQUIRED)
+ endif (GDKPIXBUF_LIBRARIES AND GDKPIXBUF_INCLUDE_DIRS)
+
+endif (NOT GDKPIXBUF_FOUND AND NOT PKG_CONFIG_FOUND)
+