Qt creator can not parse cmake version after update from Qt 6.5.3 to Qt 6.7.2
-
this issue has stocked to me for 2 days, I really want to fix this.
Backgound
I recently update Qt 6.5.3 to Qt 6.7.2 for Windows 10, there is a issue "error: The kit needs to define a CMake tool to parse this project." when I opened a project. Then I checked Edit>Preference>Kits, I see a warning says Cmake is unconfigured.
and I check Cmake Setting, It says cmake version is not parseable.
And there is no Cmake generator
What have I done
I tried to remove all components of Qt and install all over again using Qt maintenance tool, but nothing changes, I tried to install Qt creator Community 13.0.2 and Qt Creator 14.0.0-beta2 Community but nothing changes, I tried to Install Qt 6.5.3, Qt 6.6.3 and Qt 6.7.2 but nothing changes.
I checked my enviromment path, I think everything is fine.
Qt672 meas kits path for Qt 6.7.2, I alse have QT663 and qt653 for each specific version of Qt kit.
What is bizzared
I use Qt design studio for fun and I checked its preference setting, I found Qt design studio can parse Cmake version!!!!
And this show what I installed
This is so frustrating and sucks! I search every related web page, asked ChatGPT mang questions, But I really can not find a solution.
Any suggestion will be appreciated, Please help me!
-
I would suggest starting the Maintainance Tool and reinstall the CMake version (first remove, restart, and add again).
Qt Creator gets the Qt SDK CMake information from
C:\Qt\Tools\sdktool\share\qtcreator\QtProject\qtcreator\cmaketools.xml
. Have a look in the xml file and check for sanity.Here is my version:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE QtCreatorCmaketools> <!-- Written by sdktool , 2024-07-12T09:30:39. --> <qtcreator> <data> <variable>CMakeTools.0</variable> <valuemap type="QVariantMap"> <value type="bool" key="Autodetect">true</value> <value type="QString" key="Binary">C:/Qt\Tools\CMake_64\bin\cmake.exe</value> <value type="QString" key="DisplayName">CMake 3.29.3 (Qt)</value> <value type="QString" key="Id">qt.tools.cmake</value> </valuemap> </data> <data> <variable>CMakeTools.Count</variable> <value type="int">1</value> </data> <data> <variable>Version</variable> <value type="int">1</value> </data> </qtcreator>
Qt Creator uses
sdktool/share/qtcreator/QtProject/qtcreator/cmaketools.xml
as a template for it's own settings.Go to
"%appdata%\QtProject\qtcreator\cmaketools.xml"
and again check for sanity.My version looks like this:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE QtCreatorCMakeTools> <!-- Written by QtCreator 13.0.2, 2024-07-12T09:40:59. --> <qtcreator> <data> <variable>CMakeTools.0</variable> <valuemap type="QVariantMap"> <value type="bool" key="AutoCreateBuildDirectory">false</value> <value type="bool" key="AutoDetected">true</value> <value type="bool" key="AutoRun">true</value> <value type="QString" key="Binary">C:/Qt/Tools/CMake_64/bin/cmake.exe</value> <value type="QString" key="DetectionSource"></value> <value type="QString" key="DisplayName">CMake 3.29.3 (Qt)</value> <value type="QString" key="Id">qt.tools.cmake</value> <value type="QString" key="QchFile">C:/Qt/Tools/CMake_64/doc/cmake/CMake.qch</value> </valuemap> </data> <data> <variable>CMakeTools.1</variable> <valuemap type="QVariantMap"> <value type="bool" key="AutoCreateBuildDirectory">false</value> <value type="bool" key="AutoDetected">true</value> <value type="bool" key="AutoRun">true</value> <value type="QString" key="Binary">C:/Program Files/CMake/bin/cmake.exe</value> <value type="QString" key="DetectionSource"></value> <value type="QString" key="DisplayName">System CMake at C:\Program Files\CMake\bin\cmake.exe</value> <value type="QString" key="Id">{0656c167-a015-475f-b76d-ea16048564a9}</value> <value type="QString" key="QchFile">C:/Program Files/CMake/doc/cmake/CMake.qch</value> </valuemap> </data> <data> <variable>CMakeTools.Count</variable> <value type="int">2</value> </data> <data> <variable>CMakeTools.Default</variable> <value type="QString">{0656c167-a015-475f-b76d-ea16048564a9}</value> </data> <data> <variable>Version</variable> <value type="int">1</value> </data> </qtcreator>
-
Here is the Qt Creator's function that checks for validity:
bool CMakeTool::isValid() const { if (!m_id.isValid() || !m_introspection) return false; if (!m_introspection->m_didAttemptToRun) readInformation(); return m_introspection->m_haveCapabilitites && !m_introspection->m_fileApis.isEmpty(); }
It can fail if
<value type="QString" key="Id">qt.tools.cmake</value>
is empty,Id
that is.Or if
C:\Qt\Tools\CMake_64\bin\cmake.exe -E capabilities
fails to run.Which case do you have?
-
In order to find out if Qt Creator for some reason has some borked settings in
"%appdata%\QtProject\qtcreator
you can start:$ C:\Qt\Tools\QtCreator\bin\qtcreator.exe -temporarycleansettings
-