Manage files in CMake projects

When you add new or existing files to a project, Qt Creator automatically adds them to the qt_add_executable, add_executable, or qt_add_library function in the CMakeLists.txt file.

If Qt Creator cannot recognize where the target is created, it will use the target_sources function to add the files.

For Qt Quick projects, the files are added to the qt_add_qml_module function, prefixed with the QML_FILES, SOURCES, or RESOURCES function argument.

When you rename or remove files in the Projects or File System view, Qt Creator renames them in the CMakeLists.txt file or removes them from it.

See also Create files, How To: Build with CMake, CMake, File System, and Projects.

© 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.