From 867a068332e9f12c717bd7cdf2b3b8d8a55eb396 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Valverde?= Date: Fri, 26 Aug 2022 09:42:28 +0100 Subject: [PATCH] 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 b33210750c1fc38fe4ee827443e2c8a3aeaafc88. --- CMakeLists.txt | 7 ++++++- docbook/developer-guide.adoc | 2 +- docbook/wsdg_src/WSDG_chapter_libraries.adoc | 3 ++- docbook/wsdg_src/WSDG_chapter_quick_setup.adoc | 9 +++++---- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4384cbb564..e9a3ebdd99 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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}") diff --git a/docbook/developer-guide.adoc b/docbook/developer-guide.adoc index 8cc8de7150..61aebfa54e 100644 --- a/docbook/developer-guide.adoc +++ b/docbook/developer-guide.adoc @@ -17,7 +17,7 @@ endif::[] // XXX This should be surrounded by single quotes in the text. It’s // 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[] diff --git a/docbook/wsdg_src/WSDG_chapter_libraries.adoc b/docbook/wsdg_src/WSDG_chapter_libraries.adoc index 6297ba0104..cc62a44fca 100644 --- a/docbook/wsdg_src/WSDG_chapter_libraries.adoc +++ b/docbook/wsdg_src/WSDG_chapter_libraries.adoc @@ -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] diff --git a/docbook/wsdg_src/WSDG_chapter_quick_setup.adoc b/docbook/wsdg_src/WSDG_chapter_quick_setup.adoc index 4cf05816fc..95c42f4035 100644 --- a/docbook/wsdg_src/WSDG_chapter_quick_setup.adoc +++ b/docbook/wsdg_src/WSDG_chapter_quick_setup.adoc @@ -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 Qt’s 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}. ==== --