Q:

cmake: 'add_custom_target' - using 'file' command

I'm trying to create a custom target which should be used to cleaning out the output of my program.
Is it possible to do something like this:
    add_custom_target(
        clean_output
        file(REMOVE_RECURSE ${PROJECT_BINARY_DIR}/output)
    )

A:

Try the following:
add_custom_target(
    clean_output
    COMMAND ${CMAKE_COMMAND} -E remove_directory "${PROJECT_BINARY_DIR}/output"
)

