Ask Your Question

CMake problems with building with with Qt 6 on Windows

asked 2021-06-07 20:30:31 +0000

cmwDev gravatar image

updated 2021-08-30 19:10:43 +0000

Guy Harris gravatar image

I was following the step by step guide ( and I believe I did everything right using choc for the majority of the files. I am now at step 2.2.12 (generate the build files).

I modified the Visual Studio Developer command batch file to change to the folder where the various var batch files are (C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build), and then manually ran vcvars64.bat. I then changed to the C:\Development folder and ran my batch file to set the QT values (set WIRESHARK_BASE_DIR=C:\Development and set QT5_BASE_DIR=C:\Qt\6.1.0\msvc2019_64). So far so good.

I changed to the wsbuild64 folder and ran "cmake -G "Visual Studio 16 2019" -A x64 ..\wireshark" ... lots of things happened until an error happened as follows:

    CMake Error at CMakeLists.txt:1188 (find_package):
  By not providing "FindQt5Core.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Qt5Core", but
  CMake did not find one.

  Could not find a package configuration file provided by "Qt5Core" with any
  of the following names:


  Add the installation prefix of "Qt5Core" to CMAKE_PREFIX_PATH or set
  "Qt5Core_DIR" to a directory containing one of the above files.  If
  "Qt5Core" provides a separate development package or SDK, be sure it has
  been installed.

I am guessing that when I installed QT, maybe I missed adding in something needed? I searched the QT folders for any reference to Qt5CoreConfig and found nothing... SO close to being able to build a custom version... thanks kindly in advance for your assistance :)


edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2021-06-07 20:48:54 +0000

cmaynard gravatar image

updated 2021-06-07 20:51:45 +0000

set QT5_BASE_DIR=C:\Qt\6.1.0\msvc2019_64

I don't think Wireshark works with Qt 6 yet. Please try with Qt 5.15.2. And if you run into further problems, you might want to try with CMake 3.19.x instead of 3.20.x

edit flag offensive delete link more

"Use Qt’s LTS branch We recommend using the most recent “long term support” branch of Qt5 to compile Wireshark on Windows. At the time of writing this is Qt 5.15."

Chuckc gravatar imageChuckc ( 2021-06-07 21:08:30 +0000 )edit

Thanks for the feedback... I'll put 5.15 in and give it a shot, will let you know a bit later on. Appreciate the advice!

cmwDev gravatar imagecmwDev ( 2021-06-08 03:55:37 +0000 )edit

@Chuckc Wouldn't it make sense to move that note to section 2.2.3?

Jaap gravatar imageJaap ( 2021-06-08 18:17:30 +0000 )edit

Well, this is getting interesting. It works, but it doesn't. I uninstalled the QT6 version, then installed 5.15 side. When I did the cmake, it finished this time. I went into Visual Studio and loaded the snl file, but the build and run debugger items were not available. So I removed CMake 3.2 and put in 3.19x side and ran it again. CMake completed with no errors. I then used the Visual Studio command prompt, ran the compile using msbuild /m /p:Configuration=RelWithDebInfo Wireshark.sln and that completed with no errors or warnings in 6 minutes and 18 seconds. I ran the EXE it made, and it worked, tested the 'about-help' and the development help box came up. I ran a short packet capture and it seemed to work ok.

Then I loaded the SLN file in Visual Studio again, found the build and run ...(more)

cmwDev gravatar imagecmwDev ( 2021-06-08 18:51:51 +0000 )edit

@Jaap - Other than consuming the time of others, I've found the best way to master the Windows build is to break things. :-) But that's not fair to the people answering questions.
There is a statement in 2.2 to "strictly follow the recommendations below" and in 2.2.3 "at the time of this writing the Qt 5.15.2 “msvc2019 64-bit” component is used to build the official 64-bit packages."
Moving the tip 2.2.3 would reinforce the two earlier warnings.

(Dario added the original tip in a7685ddae - I wonder if there was an issue with people having multiple copies of Qt installed so the Tip was added near the setting of the environment variables?)

Chuckc gravatar imageChuckc ( 2021-06-08 19:05:18 +0000 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2021-06-07 20:30:31 +0000

Seen: 1,318 times

Last updated: Aug 30 '21