CMake: Add back a Wireshark env var to configure Qt

Use the variables WIRESHARK_QT{5,6}_PREFIX_PATH.

This allows having Qt5 and Qt6 paths configured isimultaneously and switch easily between them.

Use list(APPEND) to avoid clobbering other CMAKE_PREFIX_PATH paths.

Follow-up to b33210750c.
This commit is contained in:
João Valverde 2022-08-26 09:42:28 +01:00 committed by A Wireshark GitLab Utility
parent fc952ac2f1
commit 867a068332
4 changed files with 14 additions and 7 deletions

View File

@ -1185,10 +1185,15 @@ ws_find_package(Systemd BUILD_sdjournal HAVE_SYSTEMD)
if(BUILD_wireshark OR BUILD_logray)
if(USE_qt6)
set(qtver "6")
if(DEFINED ENV{WIRESHARK_QT6_PREFIX_PATH})
list(APPEND CMAKE_PREFIX_PATH $ENV{WIRESHARK_QT6_PREFIX_PATH})
endif()
else()
set(qtver "5")
if(DEFINED ENV{WIRESHARK_QT5_PREFIX_PATH})
list(APPEND CMAKE_PREFIX_PATH $ENV{WIRESHARK_QT5_PREFIX_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})
elseif(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}")

View File

@ -17,7 +17,7 @@ endif::[]
// XXX This should be surrounded by single quotes in the text. Its
// currently surrounded by plus signs for AsciiDoc compatibility.
:dlt-glob: DLT_*
:qt-lts-version: 6.2.4
:qt6-lts-version: 6.2.4
:source-highlighter: coderay
include::wsdg_src/WSDG_preface.adoc[]

View File

@ -72,7 +72,8 @@ It is available at https://www.qt.io/download-open-source/#section-2[].
Qt 6 must be installed manually from the Qt installers page https://www.qt.io/download-open-source/#section-2[] using the version of Qt appropriate for your compiler.
The environment variable CMAKE_PREFIX_PATH (see `https://doc.qt.io/qt-6/cmake-get-started.html`) should be set to your Qt installation directory, e.g. _C:\Qt{backslash}{qt-lts-version}\msvc2019_64_.
The CMake variable CMAKE_PREFIX_PATH (see `https://doc.qt.io/qt-6/cmake-get-started.html`) should be set to your Qt installation directory, e.g. _C:\Qt{backslash}{qt6-lts-version}\msvc2019_64_.
Alternatively you can also use the environment variable WIRESHARK_QT6_PREFIX_PATH.
[#ChLibsGLib]

View File

@ -296,7 +296,7 @@ Qt, go to the https://www.qt.io/download[“Download Qt” page], select “Go
open source”, download the *Qt Online Installer for Windows* from the Qt
Project and select, for the desired Qt version, a component that matches
your target system and compiler. For example, at the time of this
writing the Qt {qt-lts-version} “msvc2019 64-bit” component is used to
writing the Qt {qt6-lts-version} “msvc2019 64-bit” component is used to
build the official 64-bit packages. The “Qt Debug Information Files”
component contains PDB files which can be used for debugging. You can
deselect all of the other the components such as “Qt Charts” or “Android
@ -306,7 +306,8 @@ Qt 6 needs the "Qt 5 Compatibility Module" to be installed as well. Additionally
"Qt Multimedia" may be installed, to support advanced controls for playing back streams in the
RTP Player dialog.
The environment variable CMAKE_PREFIX_PATH (see `https://doc.qt.io/qt-6/cmake-get-started.html`) should be set as appropriate for your environment and should point to the Qt installation directory, e.g. _C:\Qt{backslash}{qt-lts-version}\msvc2019_64_
The CMake variable CMAKE_PREFIX_PATH (see `https://doc.qt.io/qt-6/cmake-get-started.html`) should be set as appropriate for your environment and should point to the Qt installation directory, e.g. _C:\Qt{backslash}{qt6-lts-version}\msvc2019_64_
Alternatively you can also use the environment variable WIRESHARK_QT6_PREFIX_PATH.
Qt 6 is the default option for building Wireshark, but Wireshark has support for Qt 5.12 and later. To enable Wireshark to build with Qt 5 pass `-DUSE_qt6=OFF`
to cmake.
@ -542,7 +543,7 @@ Set the following environment variables, using paths and values suitable for you
> set WIRESHARK_BASE_DIR=C:\Development
> rem set WIRESHARK_LIB_DIR=c:\wireshark-win64-libs
> rem Set the Qt installation directory
> set CMAKE_PREFIX_PATH=C:\Qt{backslash}{qt-lts-version}\msvc2019_64
> set WIRESHARK_QT6_PREFIX_PATH=C:\Qt{backslash}{qt6-lts-version}\msvc2019_64
> rem Append a custom string to the package version. Optional.
> set WIRESHARK_VERSION_EXTRA=-YourExtraVersionInfo
----
@ -554,7 +555,7 @@ the Visual Studio Tools Command Prompt.
.Use of Qts LTS branch
====
It is generally recommended to use a LTS ("long term support") version for Qt. The current LTS version for Qt 6 is
{qt-lts-version}.
{qt6-lts-version}.
====
--