tags:

views:

542

answers:

1

Background

I'm trying out Scons by setting up a basic C++ sample project that has two sub-projects:

  • Prj1 is an EXE that depends on Prj2
  • Prj2 is a DLL that exports some functions

You can see the directory structure and the contents of my SConstruct and SConscript files here

Problem

The problem I'm running into is that in order to build these targets from the command line I have to specify both the relative path to their build directory and their platform specific file extensions.

For example, to build Prj1 I have to do:


build> scons ../bin/project1.exe

Likewise, to build Prj2 I have to do:


build> scons ../bin/project2.dll

Question

How can I make SCons build these projects without specifying the relative path and platform specific file extension?

Desired:


build> scons project1 
build> scons project2

Potential Solutions

  • Use Alias - I'm pretty sure this is what I want but I'm messing something up apparently. I've tried the following without success:

prj1_env.Alias( 'project1', PROG)
prj1_env.Alias( 'project1', os.path.join( BIN_DIR, PROG) )

References

+1  A: 
grieve
Sweet. I had just figured this out about 20mins ago and was going to write up the answer after lunch. I did it exactly the way you described in the first way and it worked like a charm. Thanks for the help!
Burly