使用cmake时,可以在cmakelist.txt中如下执行shell
一,方法1
set(LOG "log.txt")
add_custom_command(OUTPUT ${LOG}
COMMAND echo "Generating log.txt file..."
COMMAND echo "welcome"
COMMAND sh -x shell.sh
COMMENT "This is a test"
)
add_custom_target(T1 ALL DEPENDS ${LOG})
add_custom_command(TARGET T1 PRE_BUILD COMMAND echo "hello" COMMENT "This command will be executed before build target T1" )
原文:http://blog.csdn.net/lv_xinmy/article/details/19567319