Add GTK3 cmake options. It doesn't build, just like its configure pendant.
authorJörg Mayer <jmayer@loplof.de>
Wed, 8 Jun 2011 18:10:03 +0000 (18:10 -0000)
committerJörg Mayer <jmayer@loplof.de>
Wed, 8 Jun 2011 18:10:03 +0000 (18:10 -0000)
svn path=/trunk/; revision=37623

CMakeLists.txt
CMakeOptions.txt
cmake/modules/FindGTK3.cmake [new file with mode: 0644]

index b7a282c93510a4b690a88682b2d09c0224eee21a..d795c6d1812bc2dd641fabbd0e3d5174209b989b 100644 (file)
@@ -235,9 +235,14 @@ set(PACKAGELIST ${PACKAGELIST} HtmlViewer)
 
 #Build the gui ?
 if(BUILD_wireshark)
-       set(PACKAGELIST ${PACKAGELIST} GTK2)
-       set(GTK2_OPTIONS COMPONENTS gtk)
-       set(GTK2_DEBUG false)
+       if(ENABLE_GTK3)
+               set(PACKAGELIST ${PACKAGELIST} GTK3)
+               set(UI_MANAGER ON)
+       else()
+               set(PACKAGELIST ${PACKAGELIST} GTK2)
+               set(GTK2_OPTIONS COMPONENTS gtk)
+               set(GTK2_DEBUG false)
+       endif()
 endif()
 
 if(BUILD_dumpcap)
@@ -361,6 +366,10 @@ endif()
 if(ENABLE_AIRPCAP)
        set(HAVE_AIRPCAP 1)
 endif()
+# No matter which version of GTK is present
+if(GTK2_FOUND OR GTK3_FOUND)
+       set(GTK_FOUND ON)
+endif()
 # That's the name autofoo uses
 if(HAVE_LIBZLIB)
        set(HAVE_LIBZ 1)
@@ -414,7 +423,7 @@ add_subdirectory( tools/lemon )
 add_subdirectory( wiretap )
 add_subdirectory( wsutil )
 
-if(BUILD_wireshark AND GTK2_FOUND)
+if(BUILD_wireshark AND GTK_FOUND)
        add_subdirectory( gtk )
 endif()
 
@@ -635,10 +644,11 @@ set(LIBEPAN_LIBS
                ${M_LIBRARIES}
 )
 
-if(BUILD_wireshark AND GTK2_FOUND)
+if(BUILD_wireshark AND GTK_FOUND)
        set(wireshark_LIBS
                ui
                ${GTK2_LIBRARIES}
+               ${GTK3_LIBRARIES}
                codecs
                ${PORTAUDIO_LIBRARIES}
                ${LIBEPAN_LIBS}
index adf95db057a26a69be76f4bf5bc6a5397f80294e..9ee5889ce336d4a3b5c174b00c089ab406f143f8 100644 (file)
@@ -17,6 +17,7 @@ option(AUTOGEN_pidl      "Autogenerate pidl dissectors" OFF)
 
 option(DISABLE_WERROR    "Do not treat Warnings as errors" OFF)
 option(ENABLE_EXTRA_GCC_CHECKS "Do additional -W checks in GCC (disables -Werror)" OFF)
+option(ENABLE_GTK3       "Use GTK3 instead of GTK2" OFF)
 option(ENABLE_AIRPCAP    "Enable Airpcap support" ON)
 # todo
 option(ENABLE_STATIC     "Build a static version of Wireshark (not yet working)" OFF)
diff --git a/cmake/modules/FindGTK3.cmake b/cmake/modules/FindGTK3.cmake
new file mode 100644 (file)
index 0000000..8e5a49b
--- /dev/null
@@ -0,0 +1,50 @@
+# - Try to find GTK3
+#
+# $Id$
+#
+# Once done this will define
+#
+#  GTK3_FOUND - System has GTK3
+#  GTK3_INCLUDE_DIRS - The GTK3 include directory
+#  GTK3_LIBRARIES - The libraries needed to use GTK3
+#  GTK3_DEFINITIONS - Compiler switches required for using GTK3
+#=============================================================================
+# Copyright 2011 Duncan Mac-Vicar P. <duncan@kde.org>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+#  License text for the above reference.)
+
+# use pkg-config to get the directories and then use these values
+# in the FIND_PATH() and FIND_LIBRARY() calls
+FIND_PACKAGE(PkgConfig)
+PKG_CHECK_MODULES(PC_GTK3 gtk+-3.0 QUIET)
+SET(GTK3_DEFINITIONS ${PC_GTK3_CFLAGS_OTHER})
+
+FIND_PATH(GTK3_INCLUDE_DIR NAMES "gtk/gtk.h"
+   HINTS
+   ${PC_GTK3_INCLUDEDIR}
+   ${PC_GTK3_INCLUDE_DIRS}
+   PATH_SUFFIXES "gtk-3.0"
+   )
+SET(GTK3_INCLUDE_DIRS ${PC_GTK3_INCLUDE_DIRS})
+
+FIND_LIBRARY(GTK3_LIBRARIES NAMES gtk-3 gtk3
+   HINTS
+   ${PC_GTK3_LIBDIR}
+   ${PC_GTK3_LIBRARY_DIRS}
+   )
+
+# handle the QUIETLY and REQUIRED arguments and set GTK3_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK3 DEFAULT_MSG GTK3_LIBRARIES GTK3_INCLUDE_DIRS)
+
+MARK_AS_ADVANCED(GTK3_INCLUDE_DIRS GTK3_LIBRARIES)
+