使用cmake时,可以在cmakelist.txt中如下执行shell
一,方法1
复制代码
1
2
3
4
5
6
7
8
9
10
11set(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
复制代码
1
2
3
4
5add_custom_command(TARGET T1 PRE_BUILD COMMAND echo "hello" COMMENT "This command will be executed before build target T1" )
最后
以上就是孝顺丝袜最近收集整理的关于CMake 执行shell的全部内容,更多相关CMake内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复