[Scons-users] how to use parhs properly

Mats Wichmann mats at wichmann.us
Sun Jul 3 12:14:14 EDT 2022


On 7/3/22 03:05, daggs wrote:
> Greetings,
> 
> the project I'm working is using scons and looks like this tree-wise:
> 
> root
>    src
>      a
>      b
>      c
>      h
>    tools
>      d
> 
> modules a to c are compiled directly using scons (the other are shell cmds or just code folders).
> I think I understand how the structure works, e.g.
> $O/$mode/a/..., $O/$mode/b/..., $O/$mode/c/... for objects and $T/$mode/a/..., $T/$mode/b/..., $T/$mode/c/... for targets
> as I'm working with variantdir.
> 
> thing is, I'm not sure how to address the paths, relative to root or absolute.
> whenever I use absolute and post here questions, I get a remark that I should use relative.
> but if I need to include root/src/h in both a and b modules, I must use absolute path or else scons will generate invalid include path.
> 
> so, what is the proper way to work?

Could you elaborate? Seem to be a few details missing.

Adding the path #root/src/h to CPPPATH should work fine.  unless...

unless you're using VariantDir() directly.  The reason using VariantDir
directly is, ummm, "unfortunate" is that the paths to things in the
variant in this circumstance are visible. It you instead use an
SConscript() call to set the variant directory, you don't have this
problem, as now the remapping happens "behind the scenes".




More information about the Scons-users mailing list