Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SCons copying 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 this doesn't work.

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

How can I do this with SCons?

like image 776
dinfuehr Avatar asked Jun 13 '12 12:06

dinfuehr


1 Answers

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

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 the Install() builder, like this:

prgTarget = env.Program( "program_name", [ "file1.cc", "file2.cc" ] )
Install("../program_name", source = prgTarget)
like image 136
Brady Avatar answered Nov 02 '22 00:11

Brady