c – SCons将编译后的程序复制到父目录

前端之家收集整理的这篇文章主要介绍了c – SCons将编译后的程序复制到父目录前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我试图在自动编译后将生成的程序文件复制到父目录.

我尝试过这个,但这不起作用.

env.Program( "program_name",[ "file1.cc","file2.cc" ] )
Copy( "../program_name","program_name" )

我怎么能用SCons做到这一点?

解决方法

更好的方法是使用目标和Command()构建器,如下所示:
prgTarget = env.Program( "program_name","file2.cc" ] )
Command(target = "../program_name",source = prgTarget,action = Copy("$TARGET","$SOURCE"))

或者根据具体情况,使用Install() builder,如下所示:

prgTarget = env.Program( "program_name","file2.cc" ] )
Install("../program_name",source = prgTarget)
原文链接:https://www.f2er.com/c/239441.html

猜你在找的C&C++相关文章