Manage files in CMake projects

When you use project wizard templates to add 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 you use custom API, Qt Creator uses 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 CMake, Add libraries to CMake projects, Create files, Edit CMake configuration files, View CMake project contents, 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.