Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Cannot compile individual .cpp files in Qt Creator with imported CMake build
Robert Hairgrove last edited by Robert Hairgrove
When I build a project using
qmake, compiling a single source file I had just edited always worked by simply right-clicking on the file in the Projects list and selecting "Build" from the context menu.
I built another project (not my own) using the
cmakebuild system which I had cloned from their GitLab hosting site. I built it first successfully from the command line using just
cmake, then imported the top-level
CMakeFiles.txtinto Qt. It parses and builds everything successfully when I build the whole project.
However, after editing a single file, for eample named
xyz.cpp, and trying to just compile it as described above, I get the error:
:-1: error: No rule to make target 'xyz.cpp.o'. Stop.
Is there another way to do this? Otherwise, I have to wait several minutes for CMake to go through the whole build process just for one file.
I am using Qt Creator 4.12.2 on Linux Ubuntu 18.04.4 with GCC version 7.5.0. It is a KDE5 project which provides its own Qt libraries which are version 5 (not sure about the minor version number, though). My local Qt installation is 5.12.9, but this isn't used by that project.