CMake: Add support for WIRESHARK_QT6_PREFIX_PATH.

If USE_qt6 is enabled, set CMAKE_PREFIX_PATH to WIRESHARK_QT6_PREFIX_PATH
if it's defined. This lets you more easily switch between Qt 5 and
6 builds. Note that we have experimental support for Qt 6 in the
Developer's Guide.
This commit is contained in:
Gerald Combs 2022-03-21 12:07:13 -07:00
parent 0a351fb6ba
commit 829fb032e4
3 changed files with 16 additions and 9 deletions

View File

@ -1182,13 +1182,17 @@ ws_find_package(Systemd BUILD_sdjournal HAVE_SYSTEMD)
if(BUILD_wireshark) if(BUILD_wireshark)
if(USE_qt6) if(USE_qt6)
set(qtver "6") set(qtver "6")
if(DEFINED ENV{WIRESHARK_QT6_PREFIX_PATH})
set(CMAKE_PREFIX_PATH $ENV{WIRESHARK_QT6_PREFIX_PATH})
endif()
else() else()
set(qtver "5") set(qtver "5")
endif() # XXX We used to recommend setting QT5_BASE_DIR. Remove after the 4.0 branch is created.
# We used to recommend setting QT5_BASE_DIR and should probably deprecate this at some point. if(WIN32 AND DEFINED ENV{QT5_BASE_DIR})
if(WIN32) message(WARNING "Support for QT5_BASE_DIR will be removed in a future release.")
set(QT5_BASE_PATH "$ENV{QT5_BASE_DIR}") set(QT5_BASE_PATH "$ENV{QT5_BASE_DIR}")
set(CMAKE_PREFIX_PATH "${QT5_BASE_PATH}") set(CMAKE_PREFIX_PATH "${QT5_BASE_PATH}")
endif()
endif() endif()
if(APPLE AND EXISTS /usr/local/opt/qt5) if(APPLE AND EXISTS /usr/local/opt/qt5)
# Homebrew installs Qt5 (up to at least 5.11.0) in # Homebrew installs Qt5 (up to at least 5.11.0) in

View File

@ -77,8 +77,8 @@ must be set appropriately.
=== Qt === Qt
The Qt library is used to build the UI for Wireshark and is used to provide a The Qt library is used to build the UI for Wireshark and is used to provide a platform independent UI.
platform independent UI. Wireshark can be built with Qt 5.3 or later. Wireshark can be built with Qt 5.6 or later and has experimental support for Qt 6.
For more information on the Qt libraries, see <<ChUIQt>>. For more information on the Qt libraries, see <<ChUIQt>>.

View File

@ -298,8 +298,11 @@ Note that installation of separate Qt components are required for 64 bit and 32
The components are forward compatible; you can build Wireshark using Qts “msvc2019 64-bit” and Visual {cpp} 2022. The components are forward compatible; you can build Wireshark using Qts “msvc2019 64-bit” and Visual {cpp} 2022.
The environment variable `https://doc.qt.io/qt-5/cmake-get-started.html[CMAKE_PREFIX_PATH]` should be set as appropriate for your environment and should point to the Qt installation directory, e.g. _C:\Qt{backslash}{qt-lts-version}.2\msvc2019_64_ The environment variable `https://doc.qt.io/qt-5/cmake-get-started.html[CMAKE_PREFIX_PATH]` should be set as appropriate for your environment and should point to the Qt installation directory, e.g. _C:\Qt{backslash}{qt-lts-version}.2\msvc2019_64_
The Qt maintenance tool (_C:\Qt\MaintenanceTool.exe_) can be used to Wireshark has experimental support for Qt 6.
upgrade Qt to newer versions. If you would like to build Wireshark with Qt 6 you must install it along with the “Qt5 Compatibility Module” component and and pass `-DUSE_qt6=ON` to cmake.
You can optionally set the `WIRESHARK_QT6_PREFIX_PATH` environment variable to your Qt 6 installation directory instead of `CMAKE_PREFIX_PATH`.
The Qt maintenance tool (_C:\Qt\MaintenanceTool.exe_) can be used to upgrade Qt to newer versions.
[#ChSetupPython] [#ChSetupPython]