我试图在自动编译后将生成的程序文件复制到父目录.
我尝试过这个,但这不起作用.
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)