nil
nil

Reputation: 295

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

Upvotes: 6

Views: 1248

Answers (1)

ixSci
ixSci

Reputation: 13708

Try the following:

add_custom_target(
    clean_output
    COMMAND ${CMAKE_COMMAND} -E rm -rf "${PROJECT_BINARY_DIR}/output"
)

Upvotes: 8

Related Questions