aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJörg Mayer <jmayer@loplof.de>2013-04-25 23:04:19 +0000
committerJörg Mayer <jmayer@loplof.de>2013-04-25 23:04:19 +0000
commitc3d7f57f58bcc7062b9b1bb8cc438e0b57806505 (patch)
tree798125b6fe067eaffa7ffaa891420b57a4bf44ab
parent7d2c6f30004ce23445c268fc8c7035fddac124b4 (diff)
Add Qt5 build support with cmake. Just do cmake ... -DENABLE_QT5=ON ...
svn path=/trunk/; revision=49042
-rw-r--r--CMakeLists.txt24
-rw-r--r--CMakeOptions.txt3
-rw-r--r--ui/qt/CMakeLists.txt33
3 files changed, 43 insertions, 17 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b2e133780d..19032a7db0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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}")
diff --git a/CMakeOptions.txt b/CMakeOptions.txt
index 73927038d0..72bf4cfb52 100644
--- a/CMakeOptions.txt
+++ b/CMakeOptions.txt
@@ -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
diff --git a/ui/qt/CMakeLists.txt b/ui/qt/CMakeLists.txt
index 0b16224eee..51614c9211 100644
--- a/ui/qt/CMakeLists.txt
+++ b/ui/qt/CMakeLists.txt
@@ -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}