[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Path interpretation in CPPPATH ?
From: |
Johan Holmberg |
Subject: |
Path interpretation in CPPPATH ? |
Date: |
Thu, 21 Dec 2000 14:10:20 +0100 (MET) |
I'm somewhat confused about how path's specified in CPPPATH are
interpreted. I have this example:
---------------- Construct ----------------
$e = cons->new( CPPPATH => "inc1" );
$e->Objects("f1.c");
Export qw( e );
Build qw( sub/Conscript );
---------------- sub/Consctipt -----------
Import qw( e );
$e = $e->clone( CPPPATH => "inc2" );
$e->Objects("f2.c");
------------------------------------------
When I run cons I get:
$ cons . -pa
f1.o:
... cc -Iinc1 -c f1.c -o f1.o
sub/f2.o:
... cc -Iinc2 -c sub/f2.c -o sub/f2.o
The thing that I think is illogical is that the cpp-path specified
in the "src/Conscript" is interpreted relative to the top-directory
instead of relative to the "sub" sub-directory. All other paths are
evaluated releative to the directory where the Conscript file lives
(the file "f2.c" for example).
The "problem" occurs when I clone a cons environment that
has been imported from a superior Conscript/Construct file.
The new environment seems to inherit the "cwd" of the previous
cons environment.
I know that I can use "DirPath" to produce the behaviour I want:
$e = $e->clone( CPPPATH => DirPath("inc2") );
but I wonder if the current behaviour of cons is intentional.
Or is it just an "accidental" (mis-)feature ?
Or are there other reasons for inheriting the "cwd" of environments
when "cloning" ?
If not, I think it would make more sense to also interpret the
CPPPATH relative to the directory where it occurs.
/Johan Holmberg
- Path interpretation in CPPPATH ?,
Johan Holmberg <=