I have been busy improving the CMake support in Qt Creator for the last couple of weeks and thought I should take the time to highlight some of the new features.
The CMake project has announced a new IDE integration mechanism with their 3.14 release called fileapi. It provides about the same level of information as the previous recommended mechanism (server-mode), but does not require a long-running cmake process. This makes the new approach use less resources while being more robust in the face of users running cmake on the command line.
“fileapi” is now supported in Qt Creator (master branch).
Demo of CMake releated features in Qt Creator master
CMake support in the Locator
Creator has allowed to trigger the build of CMake targets via the locator for a while now. Simply do
Ctrl-K to focus the locator and then type
cm <target> to build that target.
In master branch this got a small extension: Typing
cmo <target> will open the definition of a target in the editor. This works best when your CMake binary supports fileapi: It will then take you to the exact line the target is defined at. Older CMake binaries will just open the CMakeLists.txt file in the target’s source directory instead as there is no information on line numbers available.
Open targets via the Context menu
The same information that is used by the
cmo locator is used to populate a
Open... menu in the target’s context menu. That allows to jump straight to lines relevant to the target definition.
Note that this feature has been available for one specific CMake version with server-mode support before, but the necessary support in CMake got removed again and only returned in the fileapi.
That is all I have to show today:-) Please test Qt Creator with CMake 3.14 or later and provide feedback and report bugs. Unfortunately there are currently no snapshots of Qt Creator taken from the master branch, those will only become available after Qt Creator 4.10RC release.
Thanks to Alessandro for demoing these features in a short video!