Skip to main content

Qt Creator 20 - CMake Update

Comments

Here are the new CMake changes in Qt Creator 20:

CMakePresets Kits refactoring

Creation

Qt Creator has supported CMakePresets since Qt Creator 9, but there was a drawback: the Kits that were generated for the CMakePresets were global. When using multiple projects with CMakePresets, this would result in a pollution of global Kits, and users would have to do manual cleanup themselves.

Qt Creator 20 fixes this by making the CMakePresets Kits temporary and project-specific by using the Project Name : Preset Name naming scheme.

Compiler and Qt vendor extension

You can specify the compiler for a CMake preset via the CMAKE_CXX_COMPILER, and CMAKE_C_COMPILER CMake variables, or via the CC and CXX environment variables. For the Qt version, one could use the toolchainFile variable to point to a qt.toolchain.cmake file, or set the CMAKE_PREFIX_PATH or QT_QMAKE_EXECUTABLE CMake variables.

Qt Creator 20 allows, under the vendor/qt.io/QtCreator/1.0 key and qt and compiler/cxx and compiler/c subkeys, the direct specification of these variables. This is similar to how debugger was introduced in Qt Creator 14.

Note that the Qt, compilers, and debugger will be marked as temporary.

Error reporting

Previously, when a Kit failed to find the Qt or compiler version, the information that something was wrong could only be found by using QT_LOGGING_RULES=qtc.cmake.import*=true.

Qt Creator 20 will display an issue with the information about the failure.

Reloading

When saving the CMakePresets.json or CMakeUserPresets.json files, the Build > Reload CMake Presets action will be triggered automatically.

find_package dependency provider

As it turns ou,t there are Qt Components that depend on other Qt Components, but the dependency between the components was not handled by the Qt SDK automatically.

Such an example is Qt SerialBus, which depends on SerialPort.

Qt Creator 20 will now mention Qt SerialPort when a find_package(Qt6 COMPONENTS SerialBus) is used.

Comments

Subscribe to our blog

Try Qt 6.11 Now!

Download the latest release here: www.qt.io/download

Qt 6.11 is now available, with new features and improvements for application developers and device creators.

We're Hiring

Check out all our open positions here and follow us on Instagram to see what it's like to be #QtPeople.