2014-03-04 43 views
0

讓我們考慮,我已經註冊了一個自定義命令的目標:何時觸發cmakes add_custom_command POST_BUILD?

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

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. 
+0

咳咳,好吧,我承擔責任)。似乎我對文檔的閱讀不夠徹底...... – tssch