[Scons-users] when to use depends and when to use requires

daggs daggs at gmx.com
Thu Nov 10 11:50:29 EST 2022


> On 11/10/22 05:35, daggs wrote:
> > Greetings,
> > 
> > I still don't know what are the proper guidelines to use Depends or Requires.
> > I had an example of a target a and target b, target a depends on b, b creates a few files, one of them is needed for target a. I used Depends here.
> > depending target a on target b didn't enforced the proper order, adding the relevant file to the dep list didn't worked, however, when I changed it into Requires,
> > the order was enforced.
> > from that I deduce that for code files which I need to use as part of another target I should use Requires while for the rest, I should use Depends.
> > 
> > am I right?
> 
> I don't know if we explain it well enough - not sure I fully understand 
> either.
> 
> At the surface level (someone please jump in and correct me here):
> 
> Requires() is for specifying order. It does not establish dependencies. 
> If something else already decides A and B will be built, then having A 
> Require B means SCons will decide to build B before A.  Since it's not a 
> dependency, rebuilding B doesn't automatically trigger rebuilding A.
> 
> Depends() is for declaring a dependency to SCons that it won't otherwise 
> decect by itself. It says nothing about order, because that's something 
> SCons gets to decide, based on its evaluation of the dependency graph. 
> In many cases, of course, a dependency *does* end up acting as a kind of 
> ordering - but it's not certain.
> 
> Looking at the manpage I don't think I'm actually saying anything 
> different that it does.

so I need both Depends and both Require?


More information about the Scons-users mailing list