[Qt-interest] Lots of problems with cmake.
Andreas Pakulat
apaku at gmx.de
Fri Jun 12 22:23:19 CEST 2009
On 12.06.09 10:32:02, Clinton Stimpson wrote:
>
> >
> >
> >> # what on earth does this do?
> >>
> >
> > No idea, but its not needed to use Qt.
>
> You're saying this is not needed?
> include(${QT_USE_FILE})
No its not needed, all thats needed is FindQt4.cmake (well technically
speaking not even that, but then you end up either re-inventing that module
or hardcoding paths)
> That's why there's so many different examples on the web.
> Some use it, some don't. Those who don't have more complex
> CMakeLists.txt files.
Not necessarily, especially when you only use the standard modules
(QtCore/QtGui) it doesn't make a lot of sense to use the use-module as
well. I know the use-module hides some of the details of checking wether a
particular Qt part is installed (like QtXml, QtWebKit or QtUiTools), but at
the same time that also means your project might get harder to read.
In particular if FindQt4+UseQt4 are put into the top-level CMakeLists, but
the actual targets are distributed. Now when you read:
target_link_library(foo ${QT_LIBRARIES})
its not clear anymore which exact Qt libs are linked to. Not to mention
that a target might link to unecessary libs this way.
> Since Qt requires a complex build environment (beyond include
> directories and libraries to link with), the UseQt4.cmake file can be
> used to make it easier.
No it cannot. The Qt use file doesn't help with anything but include dirs
and libs as far as I know and can see from this example. In particular it
doesn't help with the ugly "having to run a macro to generate moc's from
headers and cpp's" or the not less ugly "having to run a macro to generate
code from .ui files". Thats the "complex" things about Qt in the build env,
both of which are minor annoyances, but nothing really complex IMHO.
Andreas
--
Beware of a tall blond man with one black shoe.
More information about the Qt-interest-old
mailing list