Qt Creator/CMake support for MSVC broken in 4.9.0
Since Qt Creator 4.9.0 has come out, neither I nor my colleagues can build a CMake project using Visual C++ from within Qt Creator any more.
On three different computers we've tried four different versions of Visual Studio (2013/15/17/19) and two different versions of CMake (3.13.4 and 3.14.0). In each case:
CMake works perfectly well from the command line, with either gcc or MSVC.
If CMake is used to generate a Visual Studio project from the command line, then the resulting project works perfectly.
If the CMakeLists.txt file is opened by Qt Creator and used as a 'project file' to build with gcc, then everything works perfectly.
If we attempt to switch the kit to MSVC - as used to work perfectly up to and including Qt Creator 4.8.2 - it always fails. A typical example of the error messages given is:
Starting to parse CMake project, using: "-DCMAKE_CXX_COMPILER:STRING=C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/BIN/amd64/cl.exe", "-DCMAKE_C_COMPILER:STRING=C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/BIN/amd64/cl.exe", "-DCMAKE_PREFIX_PATH:STRING=C:/Qt/5.12.2/msvc2015_64", "-DQT_QMAKE_EXECUTABLE:STRING=C:/Qt/5.12.2/msvc2015_64/bin/qmake.exe". The CXX compiler identification is MSVC 19.0.24215.1 Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/BIN/amd64/cl.exe CMake Error: Generator: execution of make failed. Make command was: "jom" "/nologo" "cmTC_17ebd\fast" Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/BIN/amd64/cl.exe -- broken CMake Error at C:/Program Files/CMake/share/cmake-3.13/Modules/CMakeTestCXXCompiler.cmake:45 (message): The C++ compiler "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/BIN/amd64/cl.exe" is not able to compile a simple test program. It fails with the following output: Change Dir: C:/Users/Stephen/AppData/Local/Temp/QtCreator-fOmVVw/qtc-cmake-qIxxBLXW/CMakeFiles/CMakeTmp Run Build Command:"jom" "/nologo" "cmTC_17ebd\fast" The system cannot find the file specified Generator: execution of make failed. Make command was: "jom" "/nologo" "cmTC_17ebd\fast"
On the one computer which we haven't upgraded yet, so it still runs Qt Creator 4.8.2, everything still works. However, I can't figure out how to roll back, nor how to use the Maintenance Tool to upgrade Qt itself without it automatically upgrading Qt Creator as well.
Has anyone else seen this problem?
I cannot really comment to your original problem, but
However, I can't figure out how to roll back, nor how to use the Maintenance Tool to upgrade Qt itself without it automatically upgrading Qt Creator as well.
Because that is indeed not possible and I'm not happy with that situation as well.
What you can do, is to install the older version parallel to the one from MaintenanceTool with an offline installer from here: http://download.qt.io/official_releases/qtcreator/4.8
In the worst case, you have to configure your Qt versions and Kits again, but most often you can just use both versions in parallel.
Now that's interesting; thank you.
I installed v.4.8.2 alongside v.4.9.0, rebuilt my kit manually (as turned out to be necessary), and...
Exactly the same problem, still.
So maybe v.4.9.0 is a red herring - maybe there's some other problem common to all the systems that have it installed; or maybe there's something else that it breaks when it is installed.
It looks like I need to so something more systematic, uninstalling Qt altogether and then putting the components back one at a time, not using the installer so as to avoid the automatic installation of 4.9.0. That will take some time, though.
This took some troubleshooting... including, along the way, doing a a 'scorched earth' removal of everything Qt-related from one of my computers and then rebuilding from source, which turned out to be the only way to have Qt Creator 4.8.2 without still having 4.9.0 alongside. In any case that didn't work; the behaviour was exactly the same as before.
What I eventually found was that, somehow, the CMake generator for my MSVC Kit- which used to be Ninja - had become set to jom. The setting for this was 'below the fold', right at the bottom of the 'Kits' window where it only became visible if I scrolled all the way down (see picture below). Changing this back to Ninja - with 'CodeBlocks' still selected as the 'Extra generator' - fixed the problem on all the computers where it existed.
I'm happy now - everything works, but a number of thing still puzzle me, viz.:
- How did this change happen? (I definitely didn't change it myself, as I didn't even know the setting was there, so presumably it must have happened when the upgrade to 4.9.0 took place).
- Where is this information stored? (obviously somewhere that persists through complete uninstallation and reinstallation of Qt Creator, indeed all of Qt; and I can't find any reference in the CMakeLists.txt.user file associated with my project, either)
- Why are the options of nmake, jom etc. provided when only Ninja seems to work? (...and meanwhile if I build with MinGW then the 'MinGW Makefiles' generator works fine).
In any case this was a major disruption to our workflow, so I'm relieved that it's fixed now.
I'm glad you figured it out.
Regarding your questions, I think you should ask them on the mailing list: http://lists.qt-project.org/mailman/listinfo/qt-creator
You will find the developers there. This forum is more user-orientated.