Qt Creator 7 - CMake update
February 10, 2022 by Cristian Adam | Comments
Qt Creator 7 comes with an updated CMake project configuration settings page.
Stop CMake button
The first feature that I want to point out is the “Stop CMake” button. Previously it was possible to stop the “Configure” step by pressing the “x” button fo the “Configure” progress bar.
Now it's as easy as clicking the "Stop CMake" button.
Run CMake button and additional CMake options
Now it is possible to run CMake to configure a project if it’s already configured. Previously this was only possible by setting new -D/-U<variable>
. values.
You can also pass command line options to the CMake configuration step, options like: "--warn-uninitialized"
, "--debug-find"
, and "--trace-expand"
.
Initial Configuration and Current Configuration
The “Initial CMake parameters” edit field has been refactored as a CMake variables list, and the command line options are now part of the “Additional CMake options” edit field.
“Initial Configuration” list of variables contains the variables that are used to configure the CMake project for the first time. Some default values are inherited from the kit’s CMake configuration and are displayed in Italic.
The “Initial Configuration” list of variables is saved in the project’s source directory as the CMakeLists.txt.user
file.
The “Current Configuration” contains the list of CMake variables that are present in the CMake file-api json export located at the .cmake/api/v1/reply
directory.
The variables that are inherited from the “Initial Configuration” are displayed in Italic. The mismatched values are displayed in red.
You might also notice that the grouping of the CMake variables is no longer there and that the view has alternating background colors for better visibility.
Kit CMake configuration
The kit’s CMake configuration is now easily accessible at the “Kit Configuration” button.
This CMake configuration will be passed to the “Initial Configuration” as kit values, which then are passed to the “Current Configuration” as initial values.
Setting the -DQT_CREATOR_SKIP_PACKAGE_MANAGER_SETUP:BOOL=ON
CMake variable in kit will make sure that any project using this kit will have the Qt Creator's package manager auto setup skipped.
Help links
You might have seen the “Additional CMake options” having a hyperlink. This hyperlink points to the offline CMake documentation, and if the installed CMake version doesn’t come with the CMake.qch
file, the online documentation will be used.
Blog Topics:
Comments
Subscribe to our newsletter
Subscribe Newsletter
Try Qt 6.9 Now!
Download the latest release here: www.qt.io/download.
Qt 6.9 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.
Commenting for this post has ended.
This looks very nice!
It's a little bit difficult to see in the screen recordings: Is it still possible to easily copy the initial cmake variables from e.g. a debug to a release configuration? In QtC6 this is a simple copy/paste action with the standard QTextEdit used there.
In QtC7 in Debug configuration you will have to select all items, then context menu and select Copy. Switch to Release configuration and click on the "Batch Edit..." button and there you can paste the variables.
This should be fine. Thank you!
When are we going to have came presets support?
Qt Creator 7 allows you now to pass
--preset my-preset
as an option in the "Additional CMake options" edit filed in Kit and Initial Configuration.Sure you can't edit any variables, but it's a first step 😀
Unfortunately this works only for
configuration
preset and you need to unset initial configuration values: CMAKEGENERATOR, CMAKEPREFIXPATH, QTQMAKE_EXECUTABLE . If you will try to setbuild
preset - you will no luck, because cmake requires to call like--build --preset <preset name>
instead of--build <dir> --preset <preset name>
m the second variant is throwssyntax error
output.But you can't fill or replace
--build
argument, creator just hardcoded it.Possible workaround is to create
Custom Process Step
for build like.../cmake.exe --build --preset ninja-multi-vcpkg-local-win-x86-release
but this is is a pain.So, I think this is still unusable and I don't understand why developers team didn't pay attention to this.
I feel like Qt is behind the times on modern interfaces. What at one point was the leading edge for ui and app design has now fallen behind quite a bit. Just this post alone being a highlight feature clearly ensures me that it's not going to be catching up anytime soon.
CMakePresets ?!
See my other comment about CMakePresets.
Will work with
--preset <my-pteset>
check my comment above please. It's still unusable in my opinion. Need more improvements on this functionality.
yup, that's also my problem. I'm using build presets too because they work great with visual studio code, and now I cannot use them.
Good to see the now-standard project format getting some attention.
Has the "subdirectory" project generator been updated to use CMake now?