Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I clean up the project files generated by CMake? [duplicate]

Tags:

cmake

I am using CMake to generate the project files.

Is there a command with which I can clean up all those generated project files?

like image 237
Adam Lee Avatar asked Dec 02 '14 10:12

Adam Lee


People also ask

How do I clean up CMake 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.

What files does CMake generate?

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.

Can I delete CMakeCache txt?

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.

What is CMakeLists txt?

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.


1 Answers

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 ;-)

like image 165
ollo Avatar answered Sep 30 '22 16:09

ollo