Format CMake files
You can use the cmake-format tool and local
.json configuration files to format any text in CMake files that you do not guard with a pair of fences. You must install the tool and tell Qt Creator where you installed it.
To automatically format CMake files upon file save:
- Select Preferences > CMake > Formatter.
- In CMakeFormat command, enter the path to
- Select Automatic formatting on file save to automatically format CMake files when you save them.
- In Restrict to MIME types, add the MIME types of the files to format, separated by semicolons. The default value,
text/x-cmakeformats CMake files. If the field is empty, all files are formatted.
- Select the Restrict to files contained in the current project check box to only format CMake files that belong to the current project.
© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.