We are trying to get
a large set of C++ projects working under NANT. I'm seeing a big problem
with relative paths. In many of our projects we have library references
(Linker->General->Additional Library Directories) that use relative paths
to other parts of our source tree. Unfortunately, these are not working in
NANT (RC2). If I had to guess, it seems to me that the relative paths are
coming from the directory of the *.build file of the Solution file instead of
relative to the Project files.
Our directory
structure looks something like this:
/src/default.build
/OurSoultion.sln
/ProjectDir/Proj1.vcproj
/ProjDir2/Proj2.vsproj
/Lib/other.lib
etc...
Obviously, the
projects themselves work fine - but fail in NANT. The reason I think
relative paths are working from the wrong location is because I was able to work
around the problem by adding the following to the NANT build
file.
<setenv
verbose="true">
<variable name="LIB">
<path>
<pathelement path="%LIB%" />
<pathelement dir="../Lib" />
<pathelement dir="Lib" />
<pathelement dir="../../OpenSource/Lib/Client" />
<pathelement dir="../../OpenSource/Lib" />
</path>
</variable>
</setenv>
<variable name="LIB">
<path>
<pathelement path="%LIB%" />
<pathelement dir="../Lib" />
<pathelement dir="Lib" />
<pathelement dir="../../OpenSource/Lib/Client" />
<pathelement dir="../../OpenSource/Lib" />
</path>
</variable>
</setenv>
This works because
MS honors the LIB environment var. Aside from being a pain in the butt to
set up and maintain there is another problem with this work around. For
example, there may be projects that may need these values to be different.
Also, it doesn't work for things like the "Post-Build Event" if that uses
relative paths.
Have others seen
this before? (Pardon me if this is a FAQ...) Are there other ways I
should work around the problem that will work a bit better?
Ray