2

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

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

即使“什么都不需要做”

或者只是为了以防万一必须为目标做点什么?

4

1 回答 1

3

文档

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.
于 2014-03-06T16:21:36.293 回答