SCons copy program after compilation to parent directory

I am trying to copy the generated program file to the parent directory after compilation automatically.

I tried this, but it does not work.

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

How can I do this with SCons?

+6
source share
1 answer

A better approach would be to use the target and Command () builder, for example:

 prgTarget = env.Program( "program_name", [ "file1.cc", "file2.cc" ] ) Command(target = "../program_name", source = prgTarget, action = Copy("$TARGET", "$SOURCE")) 

Or, depending on the situation, use Install () builder , for example:

 prgTarget = env.Program( "program_name", [ "file1.cc", "file2.cc" ] ) Install("../program_name", source = prgTarget) 
+8
source

Source: https://habr.com/ru/post/917967/


All Articles