cmake-gui linker errors

Hello, I am trying to build the Qt-based cmake-gui as I want to get started developing for it. I am working on Windows with Visual Studio 17 2022 as my generator and compiler, and I am able to build the base CMake executable just fine.

I have a fresh Qt installed via chocolatey, version 5.15.2. I have Qt5_Dir set to C:/Qt/5.15.2/mingw81_64/lib/cmake/Qt5 as well as Qt5Widgets_Dir, Qt5Core_Dir, Qt5Gui_Dir, and even Qt5WinExtras_Dir set to their appropriate locations. I do not have Qt6 installed, and I even set the variable to force CMake_QT_MAJOR_VERSION to 5 instead of A.

The cmake-gui sources compile perfectly fine, but they fail to link. There are only 6 linker errors, which leads me to believe the executable is at least partially linking. Here is the relevant output from calling cmake --build .:

...
  cmake.vcxproj -> C:\Users\wbowe\CMake\build\bin\Debug\cmake.exe
CMakeGUIExec.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static int __cdecl QApplica
tion::exec(void)" (__imp_?exec@QApplication@@SAHXZ) referenced in function "int __cdecl CMakeGUIExec(class CMakeSetupDi
alog *)" (?CMakeGUIExec@@YAHPEAVCMakeSetupDialog@@@Z) [C:\Users\wbowe\CMake\build\Source\QtDialog\cmake-gui.vcxproj]
qrc_CMakeSetup.obj : error LNK2019: unresolved external symbol "bool __cdecl qRegisterResourceData(int,unsigned char co
nst *,unsigned char const *,unsigned char const *)" (?qRegisterResourceData@@YA_NHPEBE00@Z) referenced in function "int
 __cdecl qInitResources_CMakeSetup(void)" (?qInitResources_CMakeSetup@@YAHXZ) [C:\Users\wbowe\CMake\build\Source\QtDial
og\cmake-gui.vcxproj]
qrc_CMakeSetup.obj : error LNK2019: unresolved external symbol "bool __cdecl qUnregisterResourceData(int,unsigned char
const *,unsigned char const *,unsigned char const *)" (?qUnregisterResourceData@@YA_NHPEBE00@Z) referenced in function
"int __cdecl qCleanupResources_CMakeSetup(void)" (?qCleanupResources_CMakeSetup@@YAHXZ) [C:\Users\wbowe\CMake\build\Sou
rce\QtDialog\cmake-gui.vcxproj]
libqtmain.a(qtmain_win.o) : error LNK2019: unresolved external symbol _Znay referenced in function WinMain [C:\Users\wb
owe\CMake\build\Source\QtDialog\cmake-gui.vcxproj]
libqtmain.a(qtmain_win.o) : error LNK2019: unresolved external symbol _Z5qMainiPPc referenced in function WinMain [C:\U
sers\wbowe\CMake\build\Source\QtDialog\cmake-gui.vcxproj]
libqtmain.a(qtmain_win.o) : error LNK2019: unresolved external symbol _ZdaPv referenced in function WinMain [C:\Users\w
bowe\CMake\build\Source\QtDialog\cmake-gui.vcxproj]
C:\Users\wbowe\CMake\build\bin\Debug\cmake-gui.exe : fatal error LNK1120: 6 unresolved externals [C:\Users\wbowe\CMake\
build\Source\QtDialog\cmake-gui.vcxproj]
  cmcldeps.vcxproj -> C:\Users\wbowe\CMake\build\bin\Debug\cmcldeps.exe
  cmsys_c.vcxproj -> C:\Users\wbowe\CMake\build\Source\kwsys\Debug\cmsys_c.lib
...

Has anyone seen this before - or better yet, is there a tutorial I could follow on building this for Windows? I didn’t see instructions anywhere in the git repo.

That looks wrong. I think you have to use an MSVC built QT. That looks like mingw built one. MSVC has .obj files not .o files.

Ah, it didn’t occur to me that the package from the chocolatey repo would be MinGW based, but it’s right there in the folder name. Thanks, I’ll retry it with MSVC QT and get back to you.

That worked. Thanks again. For reference, I just had to use aqi to install the correct package:

aqt install-qt windows desktop 5.15.2 win64_msvc2019_64