aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2018-07-06 15:15:32 +0200
committerThomas White <taw@physics.org>2018-07-06 15:15:32 +0200
commit177af3bd9f28821f153b1ed4e447b696242a8923 (patch)
tree314c08802865c27a7119e0c8b5d71ecdb0a50cc0 /CMakeLists.txt
parenta845d3061d5251c530fdaa4185ebf3059d433943 (diff)
Use either GTK2 or GTK3
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt35
1 files changed, 33 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 992e28f1..9e478840 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,12 +15,43 @@ find_package(GSL REQUIRED)
find_package(TIFF)
find_package(OpenCL)
find_package(PkgConfig)
+
pkg_search_module(GTK gtk+-3.0)
+if (NOT GTK_FOUND)
+
+ # No GTK3. Try GTK2?
+ pkg_search_module(GTK gtk+-2.0)
+ if (GTK_FOUND)
+ message(STATUS "Using GTK 2")
+ pkg_search_module(GDK gdk-2.0)
+ endif ()
+
+else ()
+
+ message(STATUS "Using GTK 3")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-deprecated-declarations")
+ pkg_search_module(GDK gdk-3.0)
+
+endif ()
+
+# If no version of GTK was found, try for GDK
+if (NOT GTK_FOUND)
+ message(STATUS "Looking separately for GDK")
+ pkg_search_module(GDK gdk-3.0)
+ if (NOT GDK_FOUND)
+ pkg_search_module(GDK gdk-2.0)
+ if (GDK_FOUND)
+ message(STATUS "Using GDK 2")
+ endif()
+ else ()
+ message(STATUS "Using GDK 3")
+ endif()
+endif()
+
pkg_search_module(CAIRO cairo)
-pkg_search_module(GDK gdk-2.0)
pkg_search_module(GDKPIXBUF gdk-pixbuf-2.0)
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fdiagnostics-color=always -Wno-deprecated-declarations")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fdiagnostics-color=always")
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
add_definitions(-DHAVE_CONFIG_H)