[CMake] cmake -E remove /path/*.txt

Eric Noulard eric.noulard at gmail.com
Fri Mar 12 07:53:50 EST 2010


2010/3/12 Alexandre Gramfort <alexandre.gramfort at inria.fr>:
> Hi,
>
> is there a way to have cmake do something like :
>
> cmake -E remove /path/*.txt
>
> I need to clear tests outputs before running new tests. I have a
> solution with a GLOB but the list of files is set during cmake
> configure
> so it does not work if I run "make test" twice without reconfiguring.

When you want build time evaluation you may write a CMake script

remove_some_file.cmake which:
   1) does the GLOB for building the LIST_OF_FILE
   2) execute_process cmake -E remove ${LIST_OF_FILE}

then in your CMakeLists.txt you add a custom_command/target which
executes:

cmake -P remove_some_file.cmake.

That way the list of file will be built at "build" time.

-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list