I'm wondering if it'd be possible to implement a mechanism to auto-configure
a project to use an external library, with cpptasks.
Ideally it would work like this (in three steps):
1) Ceate a XML file containing the library definitions (i.e. a <defineset>,
<includepath>, <libset> and maybe even a <fileset> that should be included
in projects that use the library). These definitions could be wrapped in a
purpose-built task named, e.g., <ccdefs>, which must support referencing.
2) <import> the library XML file into a project's build.xml.
3) Within a <cc> task, reference the <ccdefs> defined for the library.
For example, if my project uses the boost.org lib, I could create a
boost.xml file containing:
<includepath ... />
<libset ... />
<defineset ... />
And then in my <cc> task I could write:
<fileset ... />
<!-- etcetera -->
I've tried to emulate this behaviour in many ways, and none worked. My best
try was to add <typedefs> for IncludePath and LibrarySet, so I could define
them in the library's include file and then reference them within my <cc> (I
would have to add at least one includepath, libset and defineset for each
library, but it'd be worth it). However, though includepath and defineset do
support referencing, libset does not.
I tried to use the <compiler> task to do the trick but it's impossible if I
want to freely mix multiple libraries in each <cc> task. MacroDefs and
PreSetDefs can't do the job either, as they're not processed within other
So, is it possible to implement this mechanism without hacking cpptasks?
If it's not possible, does anyone else think it would be greatly useful? Do
you think this feature could make to the official distribution? I could try
to contribute a patch, if you think it's worth it.
Thiago Bastos a écrit :
> I'm wondering if it'd be possible to implement a mechanism to auto-configure
> a project to use an external library, with cpptasks.
In another mail you said you had implemented this feature, could it be
possible to have a patch posted for it ?
I'm really looking forward to simplify all my build files :)
Having around 20 projects at my company using a custom centralized build
system on top of cpptasks it looks like we have similar use cases.
My users mostly complain about how painfull it is to list all the
libraries needed in order to link, depending on platform and configuration.
I'm sure the feature can be usefull for others as well.