Qt Creator 6 - CMake update

Qt Creator 6 comes with bug fixes and new features that affect CMake projects.

Header files as project files

With Qt Creator 6, in order to have the header files displayed in the project tree, they need to be added to the project sources via:

add_library(my_lib [STATIC|SHARED|MODULE] [source.cpp source.h ...])
add_executable(my_exe [source.cpp source.h])
target_sources(my_target <INTERFACE|PUBLIC|PRIVATE> [source.cpp source.h])

This means that the header files will get the same treatment as the source files.

  • clang-tidy and clazy will be able to analyze them
  • The TODO plugin can find the TODOs in header files
  • The Test plugin can find the Google Tests defined in header files


No more <Headers> project node

Qt Creator 6 will no longer scan all the files in the project source directory for header files and try to match the source files with the corresponding header files.

When the source matching would fail, then the headers would be grouped in the <Headers> project node. Qt Creator 6 will always open the correct header file, even if multiple headers have the same name.

Project loading speed-up

Qt Creator 6 comes with optimizations for the project loading. See below the (hot) loading of Qt Creator 6 sources in Qt Creator 5 and Qt Creator 6.



<File System> project node displayed only on failure

The <File System> project  node is displayed only when Qt Creator cannot load a CMake project. This is done to avoid the file system scanning and have faster project loading times.

Note that you can use the “File System” widget pane for the same operation.


CMake Warnings are displayed in the Issues pane

Previously only errors were displayed in the issues pane. Now also warnings are displayed.


CMake Warning Icon in the project tree

If the project fails to load or the previous working configuration has been restored, Qt Creator 6 will display a warning icon in the project tree.

The issues pane will contain the information that otherwise would be present only in the Project Mode.


Find in CMake output in Projects mode

With Qt Creator 6, you can search with Ctrl + F in the CMake output of the Projects mode.



Blog Topics: