什么时候cmakes add_custom_command POST_BUILD被触发?

时间:2014-03-04 14:30:08

标签: cmake add-custom-command

让我们考虑一下我为目标注册了一个自定义命令:

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)

我正在努力寻找的是命令实际运行的时间。 总是在像这样检查目标之后?

[ 10%] Built target libzmq

即使'没有必要做什么'

或者只是为了目标必须要做的事情?

1 个答案:

答案 0 :(得分:2)

Documentation

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.