CMake 执行shell

时间:2014-02-21 10:46:54   收藏:0   阅读:444

使用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})

二,方法2

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

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!