[Scons-users] Linking with target alias

Chris BeHanna chris at behanna.org
Tue Aug 21 11:35:37 EDT 2012


On Aug 21, 2012, at 04:37 , Mariusz Buras <mariusz.buras at gmail.com> wrote:


> Hi there,

>

> Is there a way do something like the pseudo code below?

>

> (some scons script file)

>

> lib = env.StatidLibrary( files )

>

> env.Alias("libalias", lib )

>

> (some other scons script file executed later)

>

> prog = env.Program ( [files, env.Alias("libalias") ])

>

> This would simplify my scons scripts significantly because I wouldn't

> need to export and import targets back and forth.


Some top-level SConscript that exports env so that other SConscripts can share common path flags:

env.Append(LIBPATH = [os.path.join('#', Dir('.').path)])

Export('env')

Library SConscript:

Import('env')

env.StaticLibrary('alias', files)

Other SConscript:

Import('env')

env.Program(files, LIBS=['alias'])

Then let SCons itself worry about how to find libalias and arrange the dependencies. This works--try it!

--
Chris BeHanna
chris at behanna.org


More information about the Scons-users mailing list