The command becomes part of the target and will only execute when the
target itself is built. If the target is already built, the command will
not execute.
When is cmakes add_custom_command POST_BUILD being triggered?
-
03-06-2023 - |
Question
Lets consider that I have registered a custom command for a target:
add_custom_command(TARGET ${target_name} POST_BUILD
COMMAND cmake -E copy_if_different ${file_path} ${dest_file}
COMMENT "exporting ${file_path} to ${dest_file}"
VERBATIM)
What I am struggling to find out is when the command is actually being run. Always after the target has been checked like this ?
[ 10%] Built target libzmq
Even if 'nothing has to be done' ?
Or just in case that for the target something had to be done ?
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow