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(USE_qt6)
set(qtver "6")
if(DEFINED ENV{WIRESHARK_QT6_PREFIX_PATH})
set(CMAKE_PREFIX_PATH $ENV{WIRESHARK_QT6_PREFIX_PATH})
endif()
else()
set(qtver "5")
endif()
# We used to recommend setting QT5_BASE_DIR and should probably deprecate this at some point.
if(WIN32)
set(QT5_BASE_PATH "$ENV{QT5_BASE_DIR}")
set(CMAKE_PREFIX_PATH "${QT5_BASE_PATH}")
# XXX We used to recommend setting QT5_BASE_DIR. Remove after the 4.0 branch is created.
if(WIN32 AND DEFINED ENV{QT5_BASE_DIR})
message(WARNING "Support for QT5_BASE_DIR will be removed in a future release.")
set(QT5_BASE_PATH "$ENV{QT5_BASE_DIR}")
set(CMAKE_PREFIX_PATH "${QT5_BASE_PATH}")
endif()
endif()
if(APPLE AND EXISTS /usr/local/opt/qt5)
# Homebrew installs Qt5 (up to at least 5.11.0) in

View File

@ -77,8 +77,8 @@ must be set appropriately.
=== Qt
The Qt library is used to build the UI for Wireshark and is used to provide a
platform independent UI. Wireshark can be built with Qt 5.3 or later.
The Qt library is used to build the UI for Wireshark and is used to provide a platform independent UI.
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>>.

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 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
upgrade Qt to newer versions.
Wireshark has experimental support for Qt 6.
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]