Boost logo

Boost-Build :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2005-05-23 01:14:45


Hi Mike,

> I'm trying to get the Moc generator to automatically add its output
> directory to the list of compiler includes.
......
> The two .h files are in there because they are QObjects and need to be
> compiled by the Moc compiler. The output is a .moc.cxx file (I modified
> the qt.jam file so that instead of CPP(moc_%) it says CPP(%.moc)) that
> is included by the appropriate QObjectHeader cxx file. The problem is
> that the .moc.cxx files are generated fine, but they build directory is
> not added to the list of gcc compiler includes.

Should they? In the basic setup, the *C++* files produced by moc are
automatically compiled. You don't need to include them from .h files.

> If I do this:
>
> lib libname
>
> : [ glob *.cxx ]
>
> QObjectHeader1.h
> QObjectHeader2.h
> Temp.ui
>
> : <include>.
> :
> : : <include>.
>
> In my Jamfile and just 'touch' the 'Temp.ui' file it works fine (ie: the
> build directory is added to the list of compiler includes) but it fails
> when uic tries to compile the Temp.ui file.

With what error? Does building "example/qt-ui" work for you?

> So my question is:
>
> Is there any way to fix this so that QObject header file -> moc.cxx
> generation works the way I want it to? If not, is there some way to
> determine the build directory being used such that I can add it to the
> list of includes (can I modify the list of includes inside of a rule?) ?
>
> Also, has anyone written a scanner that automatically looks in header
> files for the Q_OBJECT line, and if it is then that file is
> automatically added to this list of sources?

No, it's not easy technically. It might be possible to write a code
that would find all files in a given directory that contain the Q_OBJECT
line. It would be easier that doing fully automatic discovery but would still
require changes in bjam.

HTH,
Volodya

-- 
Vladimir Prus
http://vladimir_prus.blogspot.com
Boost.Build V2: http://boost.org/boost-build2
 

Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk