[Scons-users] Defining build dependencies between a program and a shared library

Gary Oberbrunner garyo at oberbrunner.com
Mon Jan 27 10:51:54 EST 2014


On Mon, Jan 27, 2014 at 10:38 AM, Philippe Macaire <
philippe.macaire at gmail.com> wrote:


> env.Program('bar', ['main.cpp'], LIBPATH=['lib'], LIB=['foo'])

>

> While this looks like a decent solution, I think it is weaker because now

> SCons is unaware of the *dependency* which exists between library foo and

> program bar: in other words if library foo has to be re-built, SCons is

> unable to automatically trigger the subsequent re-link of executable bar.

>


In this case, SCons _should_ find the library dependency (and thus rebuild
when needed). If it's not doing that for you, try --tree=prune and/or
--debug=findlibs.

You are right that passing a Node (typically a File node) as an element of
Libs uses the full (top-relative) path to that lib, but passing a string
uses it as the lib name. What you're missing is that in the latter case it
looks for that lib name with all LIBSUFFIXES in the LIBPATH to find the
dependency. (If it can't find it, it assumes it's elsewhere on the system,
so it doesn't complain -- it figures the linker will complain in that case.)

--
Gary
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://four.pairlist.net/pipermail/scons-users/attachments/20140127/0535c362/attachment.htm


More information about the Scons-users mailing list