I want to add a CMake target which, when made, will trigger the following:
rm $(find "${CMAKE_SOURCE_DIR}" -name "*.rej" -or -name "*.orig")
I tried this:
add_custom_target(pclean
COMMAND bash -c "rm $(find \"${CMAKE_SOURCE_DIR}\" -name \"*.rej\" -or -name \"*.orig\")")
and this:
add_custom_target(pclean
COMMAND bash -c "find "${CMAKE_SOURCE_DIR}" -name \"*.rej\" -or -name \"*.orig\" | xargs rm")
but neither works. How should I do this right? Am I supposed to use something like add_custom_command
?
Note: The issue here is not the quotes. Thus if I use:
add_custom_target(pclean
COMMAND bash -c "find "${CMAKE_SOURCE_DIR}" -name \"*.rej\" -or -name \"*.orig\"")
I get the list of *.orig
and *.rej
files.