Reputation: 3
I want to print a message after the target clean
executed successfully.
I tried like
add_custom_command ( TARGET clean POST_BUILD
COMMAND ${CMAKE_COMMAND} -E echo "Cleanup done in Project '${CMAKE_PROJECT_NAME}'"
)
but CMake claims that "No TARGET 'clean' has been created in this directory."
Of course clean
is not created in this directory, CMake should generate this target by itself.
Is there any other way to edit clean
or add instructions?
Upvotes: 0
Views: 195
Reputation: 8152
IMHO clean should not be changed or modified, since the user expects a clearly defined behavior.
Do it that way:
add_custom_target(CustomClean
COMMAND ${your_commands}
COMMAND ${CMAKE_COMMAND} --build . --target clean --config $<CONFIG>
)
Upvotes: 1