1
我使用时有些问题PRE_BUILD
| PRE_LINK
| POST_BUILD
命令add_custom_command(...)
。当我使用POST_BUILD
,我发现该命令的目标之前将执行已建成,就像这样:CMake:为什么add_custom_command(...)中的POST_BUILD不起作用?
[[email protected]_33_35_centos build]# make
Scanning dependencies of target main
[100%] Building C object CMakeFiles/main.dir/main.c.o
Linking C executable main
This is pre build
This is post build
[100%] Built target main
的内容我CMakeLists.txt
是:
cmake_minimum_required(VERSION 2.8)
add_executable(main main.c)
add_custom_command(TARGET main
PRE_BUILD
COMMAND echo "This is pre build "
)
add_custom_command(TARGET main
POST_BUILD
COMMAND echo "This is post build"
)
为什么第8行指挥echo "This is post build"
CMakeLists.txt
不能在第7行(Linux命令)上的[100%] Built target main
消息之后执行?