[CMake] [PATCH] FindQt4.cmake qt4_automoc improvements

clinton at elemtech.com clinton at elemtech.com
Thu May 29 15:42:16 EDT 2008


On Thursday 29 May 2008 12:59:18 pm Tanguy Krotoff wrote:
> On Thu, May 29, 2008 at 8:48 PM,  <clinton at elemtech.com> wrote:
> > Your patch doesn't work with build systems that have configurations
> > (Visual Studio, XCode, etc..).
>
> Oups... I never use Visual Studio and others.
>
> > What's wrong with leaving it in UseQt4.cmake?  In general, things work
> > better if you use UseQt4.cmake (not only because of
> > QT_DEBUG/QT_NO_DEBUG).
>
> Then why separate UseQt4 and FindQt4?

A finder (FindQt4.cmake) is simply supposed to just find things and isn't 
supposed to modify your compile environment.

Qt requires a complicated enough environment to build in that a UseQt4.cmake 
helps set it up.  It also allows you to set it up within a limited scope in 
case you have a mixed Qt and non-Qt project.

Some Qt-only projects may not care about that separation.

> For example, Phonon (I didn't wrote it ;) does not use UseQt4.cmake
> and probably many other Qt apps do the same.

Yes, I have seen that many projects don't use UseQt4.cmake.
In that case, they have the extra work of setting up the compile environment.

>
> The bug that I got with QT_DEBUG/QT_NO_DEBUG not being defined is a
> pretty hard one.

Yes, it is a difficult one.  It would be nice to be able to somehow put them 
into the QT_DEFINITIONS variable, but CMake doesn't support that.

CMake 2.4.8 put them in CMakeCache.txt under CMAKE_CXX_FLAGS_<config>
But, yesterday, another user brought up an issue that resulted from that. 
http://www.cmake.org/pipermail/cmake/2008-May/022023.html

CMake 2.6 has a new SET_PROPERTY(...), which I think is a good fit.  And this 
is what the current UseQt4.cmake uses.

> I simply would like other devs not to spend time on such stupid
> issues, so how can this be prevented?

This stuff is better documented in 2.6 than it has ever been before.
http://www.cmake.org/HTML/cmake-2.6.html#module:FindQt4

There were/are some other websites that docuemented or gave examples without 
using UseQt4.cmake, which may have led to more people not using it.
But some people are getting it right.
http://da-crystal.net/GCMS/blog/cmake-amp-qt4-modules/

Clint


More information about the CMake mailing list