[Scons-users] Export command and CPPPATH concatenation
laurent.belcour at inria.fr
Sat Feb 1 03:51:54 EST 2014
Le 31 janv. 2014 à 23:12, Dirk Bächle <tshortik at gmx.de> a écrit :
> Hi Laurent,
> On 31.01.2014 22:30, Laurent wrote:
>> I recently discover a rather strange behavior of scons using the Export/Import mechanism for sharing Environment between two SConstruct. I appears that the CPPPATH is appended with the build directory but as a string and not as an array resulting in incorrect include paths.
>> Here is an example:
>> Why is scons appending the CPPPATH defined in the SConstruct as a string (resulting in ‘./A/A/B’) in the SConscript and not as a list (resulting in [‘./A’, ‘./A/B’]) ? Is this the regular behavior of scons ?
> in your example I don't see where you try to add "./A" to CPPPATH. Please check, and repost your sources if necessary.
> From your description I can only guess that you wrote something like
> env = Environment(CPPPATH='./A', …)
No, I never try to add ‘./A’ to CPPPATH, this is why I am concerned. I can send you this example by mail. I don’t know if I can add it to the user mailing list so I did not provided it.
The SConstruct and SConscript files provided in the mail are complete (except for the missing ‘)’ in the SConstruct). From the example you can see that adding './A’ to the CPPPATH is not necessary (no include file in this directory). So I did not do it. Scons is automatically adding ‘./A’ to the CPPPATH which I find rather strange.
Could it be due to the fact that the compilation directory and the root directory (in which scons is called) are not the same ?
> which sets CPPPATH to a string. Then, if you later try to add your "[./A/B]" the AppendUnique() automatically converts the list to a string and appends it (because it is already a string, the new values get converted to match).
> When specifying path variables you should always use list notation:
> env = Environment(CPPPATH=['./A'])
> Please also have a look at the thread
Thanks for the link. I am aware of this issue and use lists instead of concatenated strings in all my scons projects.
> Best regards,
> Scons-users mailing list
> Scons-users at scons.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Scons-users