Custom target artifacts from POST_BUILD
I want to make a symbolic link on linux everytime I build a library, I'm doing it this way:
add_custom_command(
TARGET ${TARGET_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E create_symlink $<TARGET_FILE:${TARGET_NAME}> ${PROJECT_BINARY_DIR}/lib/$<TARGET_LINKER_FILE_NAME:${TARGET_NAME}>
VERBATIM
)
The problem with the above sentence is that if I remove the generated link but not the target then the link is no longer generated when building the target because according to the documentation if the target is already built, the command will not execute. So how can I do to make sure that everytime that I build the target the link will be generated?
I think it would be nice to have an OUTPUT field for the POST_BUILD option, this way if the output is changed the COMMAND will be executed again.
Edited by Brad King