Add Qt5 build support with cmake. Just do cmake ... -DENABLE_QT5=ON ...
authorJörg Mayer <jmayer@loplof.de>
Thu, 25 Apr 2013 23:04:19 +0000 (23:04 -0000)
committerJörg Mayer <jmayer@loplof.de>
Thu, 25 Apr 2013 23:04:19 +0000 (23:04 -0000)
svn path=/trunk/; revision=49042

CMakeLists.txt
CMakeOptions.txt
ui/qt/CMakeLists.txt

index b2e133780d77f54fb62d8b1b796896a5f448df35..19032a7db0c132ed9efc9e39e23bb2fa89aadc09 100644 (file)
@@ -299,8 +299,14 @@ endif()
 
 # Build the Qt GUI?
 if(BUILD_qtshark)
-       set(PACKAGELIST ${PACKAGELIST} QT)
-       # set(QT_OPTIONS 4.7.1 REQUIRED QtCore QtGui)
+       if(ENABLE_QT5)
+               set(PACKAGELIST ${PACKAGELIST} Qt5Widgets Qt5PrintSupport Qt5LinguistTools)
+               set(QT_VERSION 5)
+       else()
+               set(PACKAGELIST ${PACKAGELIST} QT)
+               # set(QT_OPTIONS 4.7.1 REQUIRED QtCore QtGui)
+               set(QT_VERSION 5)
+       endif()
 endif()
 
 # SMI SNMP
@@ -391,6 +397,9 @@ foreach(PACKAGE ${PACKAGELIST})
                include_directories(${${PACKAGE}_INCLUDE_DIRS})
                message(STATUS "${PACKAGE} includes: ${${PACKAGE}_INCLUDE_DIRS}")
                message(STATUS "${PACKAGE} libs: ${${PACKAGE}_LIBRARIES}")
+               if (${PACKAGE}_DEFINITIONS)
+                       message(STATUS "${PACKAGE} definitions: ${${PACKAGE}_DEFINITIONS}")
+               endif()
        endif()
 endforeach()
 
@@ -434,8 +443,15 @@ endif()
 if(HAVE_LIBZLIB)
        set(HAVE_LIBZ 1)
 endif()
-# QT_LIBRARIES and QT_INCLUDES are not set above. They require extra magic:
-if(QT_FOUND)
+if (Qt5Widgets_FOUND)
+       set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
+       if (Qt5_POSITION_INDEPENDENT_CODE)
+               set(CMAKE_POSITION_INDEPENDENT_CODE ON)
+       endif()
+       set (QT_FOUND ON)
+       set (QT_LIBRARIES ${Qt5Widgets_LIBRARIES} ${Qt5PrintSupport_LIBRARIES})
+# If Qt4: QT_LIBRARIES and QT_INCLUDES are not set above. They require extra magic
+elseif(QT_FOUND)
        include(${QT_USE_FILE})
        include_directories(${QT_INCLUDE_DIR})
        message(STATUS "QT includes: ${QT_INCLUDE_DIR}")
index 73927038d067591fd3c52f0e2cda924ba838fc17..72bf4cfb5277cf145b3c5facb192a43a8f750687 100644 (file)
@@ -19,7 +19,8 @@ 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_GTK3       "Use GTK3 instead of GTK2 to build wireshark" OFF)
+option(ENABLE_QT5        "Use Qt5 instead of Qt4 to build qtshark" OFF)
 option(ENABLE_PCAP       "Enable libpcap support (required for capturing)" ON)
 #
 # Do not make this the default on UN*X; AirPcap support is available
index 0b16224eeee5bfeef89280d08452a62c7bf25279..51614c9211345d1e419992c2d929aa6a2ad91166 100644 (file)
@@ -172,18 +172,27 @@ include_directories(
         ${CMAKE_CURRENT_BINARY_DIR}
 )
 
-QT4_ADD_TRANSLATION(QTSHARK_TS_QM ${QTSHARK_TS})
-
-QT4_ADD_RESOURCES(QTSHARK_QRC_SRC ${QTSHARK_QRC})
-
-QT4_WRAP_UI(QTSHARK_UI_SRC ${QTSHARK_UI})
-
-# For now, do the moc stuff manually
-QT4_WRAP_CPP(QTSHARK_MOC_SRC ${QTSHARK_H_SRC})
-# Starting with cmake 2.8.6, we may also use
-# set(CMAKE_AUTOMOC TRUE)
-# or
-# set_target_properties(${some-source-files} PROPERTIES AUTOMOC TRUE)
+if (QT_VERSION EQUAL 5)
+       QT5_ADD_TRANSLATION(QTSHARK_TS_QM ${QTSHARK_TS})
+       QT5_ADD_RESOURCES(QTSHARK_QRC_SRC ${QTSHARK_QRC})
+       QT5_WRAP_UI(QTSHARK_UI_SRC ${QTSHARK_UI})
+       # For now, do the moc stuff manually
+       QT5_WRAP_CPP(QTSHARK_MOC_SRC ${QTSHARK_H_SRC})
+       # Starting with cmake 2.8.6, we may also use
+       # set(CMAKE_AUTOMOC TRUE)
+       # or
+       # set_target_properties(${some-source-files} PROPERTIES AUTOMOC TRUE)
+else()
+       QT4_ADD_TRANSLATION(QTSHARK_TS_QM ${QTSHARK_TS})
+       QT4_ADD_RESOURCES(QTSHARK_QRC_SRC ${QTSHARK_QRC})
+       QT4_WRAP_UI(QTSHARK_UI_SRC ${QTSHARK_UI})
+       # For now, do the moc stuff manually
+       QT4_WRAP_CPP(QTSHARK_MOC_SRC ${QTSHARK_H_SRC})
+       # Starting with cmake 2.8.6, we may also use
+       # set(CMAKE_AUTOMOC TRUE)
+       # or
+       # set_target_properties(${some-source-files} PROPERTIES AUTOMOC TRUE)
+endif()
 
 set(CLEAN_FILES
        ${QTSHARK_SRC}