1
votes

I use Eclipse CDT in combination with CMake and successfully followed the setup instructions detailed here. I use a custom make target to invoke CMake from within Eclipse ("Creating A Make Target To Run CMake"). It performs an out-of-source build inside a subdirectory of my source directory.

Sometimes I want CMake to rebuild everything and therefore delete all the contents of my build directory to force CMake to rebuild its cache etc.

At the moment I am using the project view to delete all the files in the subdirectory, but that is tedious and I want to automate it.

I tried to make another custom make target with rm -rf ./Build/* as the command, but that didn't work. It executed without errors but did not delete any files whatsoever.

How can I delete all files in the build subdirectory (or at least force CMake to rebuild its cache etc) by pressing a single button?

1

1 Answers

1
votes

You could write a simple shell script refresh-cmake.sh with the following contents

#!bin/bash    
rm -rf build
mkdir build
cd build
cmake ..

Just call it with ./refresh-cmake.sh from inside your project directory and you should be all set. For single-click, use a file browser and click (or double-click) the shell script's icon.