[CMake] Qt find package location

Alexander Neundorf a.neundorf-work at gmx.net
Thu Mar 12 15:37:23 EDT 2009


On Thursday 12 March 2009, A. Maitland Bottoms wrote:
> david.cole at kitware.com (David Cole) writes:
>  > If you set QT_QMAKE_EXECUTABLE to the full path to a qmake, *that* qmake
>  > is used above all else to find the right Qt. Regardless of QTDIR or
>  > PATH. Setting QT_QMAKE_EXECUTABLE is *the* official way to tell CMake
>  > where the Qt that you want is. All else is a "find-and-guess" game if
>  > you have multiple Qt's available.
>
> That used to go quite well. But as of cmake 2.6.3, something is generating
> a -- Qt3 and Qt4 cannot be used together in one project.
> finding and the build fails.
>
> So switching from qt3 to qt4 used to work, now it doesn't.

Yes, there is now a check to make sure you don't mix things.
I think it also wasn't officially supported, since there are now so many 
Qt-related variables, that it's quite hard to make sure you don't get 
anything mixed up.

The test is in FindQt4.cmake:
# If Qt3 has already been found, fail.
IF(QT_QT_LIBRARY)
  IF(Qt4_FIND_REQUIRED)
    MESSAGE( FATAL_ERROR "Qt3 and Qt4 cannot be used together in one 
project.")
  ELSE(Qt4_FIND_REQUIRED)
...

So, if QT_QT_LIBRARY is set (which exists only for Qt3, but not for Qt4), it 
stops, because you should not use both within one project.
If you want to work around this, unset QT_QT_LIBRARY.

Alex


More information about the CMake mailing list