I am using CMake to generate the project files.
Is there a command with which I can clean up all those generated project files?
Simply delete the CMakeFiles/ directory inside your build directory. rm -rf CMakeFiles/ cmake --build . This causes CMake to rerun, and build system files are regenerated.
CMake is a meta build system that uses scripts called CMakeLists to generate build files for a specific environment (for example, makefiles on Unix machines). When you create a new CMake project in CLion, a CMakeLists. txt file is automatically generated under the project root.
Deleting CMakeCache. txt should not affect any binaries, a full rebuild is not triggered. Otherwise you might have a local variable passed on before being cached which then leads to inconsistent runs. The regeneration of the project can trigger rebuilds if the configuration is different to the previous one.
CMakeLists. txt file contains a set of directives and instructions describing the project's source files and targets (executable, library, or both). When you create a new project, CLion generates CMakeLists. txt file automatically and places it in the project root directory.
Is there a command with which I can clean up all those generated project files?
Yes - if you do an out-of-source build (as recommended).
To do so, create a directory - for example, build
- within your projects directory and run CMake from there:
mkdir build cd build cmake .. make
(Or tell your IDE to do so.)
Now all generated files are within build
. To clean those, just remove the directory (rm -rf build
).
PRO: You can keep all generated files out of your versioning system by adding build
to its ignore ;-)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With