[CMake] Two bugs, Three patches, no weddings and no funeral. (Qt)

John Biddiscombe biddisco at cscs.ch
Wed Aug 24 02:40:11 EDT 2005


William A. Hoffman wrote:

>It is sounding like the idea of a FindQt.cmake is a bad one.
>Perhaps we should only support FindQt3.cmake and FindQt4.cmake,
>and if you do FindQt, it does qt3 for backwards compatibility.
>  
>
I'm in favour of this.

>That being said if QT4 is in your path, then cmake is doing the
>right thing, and it is your path that is wrong.   If you want
>  
>
True cmake is doing all that has been asked of it, but I have Qt4 
installed too and now I'm unable to find Qt3 without the supplied patch. 
I'd be grateful if you could enable the additional option that allows me 
to find Qt3 as well.As it stands, having Qt3 and 4 installed will cause 
trouble whatever the path is set to.

Digging into the registry I see
HKEY_CURRENT_USER\Software\Trolltech\Qt3Versions
which has keys for 3.2.1, 4.0.0. on my system. This might prove to be a 
useful place to find info about installed versions, I'll look into it later.

The patch I have supplied, is simple and should fix the trouble for now. 
(subject to SystemTools issue being fixed too).

JB

>to use an older version, then you will have to set QT_QMAKE_EXECUTABLE
>by hand, either in CMakeSetup, ccmake, or an initial cache.
>IF the QT_MAX_VERSION does not match the QT_QMAKE_EXECUTABLE that was
>found an error should be flagged, instructing a user to change
>QT_QMAKE_EXECUTABLE in the cache.
>
>-Bill
>
>
>At 12:37 PM 8/23/2005, John Biddiscombe wrote:
>  
>
>>I've just updated cmake from cvs and have set
>>QT_MAX_VERSION 3.9.9
>>
>>and in environment
>>QTDIR=c:\qt\3.2.1
>>
>>but cmake still pulls in qt4. I see from looking at the findQt module that a lot of checking is done on various variables, but the QT_MAX_VERSION has no effect because the first thing findQt does is to
>>FIND_PROGRAM(QT_QMAKE_EXECUTABLE NAMES qmake PATHS $ENV{QTDIR}/bin)
>>and since qt4 put itself on my path when it was installed - it gets found, once this has been located, later we have
>>  EXEC_PROGRAM( ${QT_QMAKE_EXECUTABLE}
>>    ARGS "-query QT_INSTALL_HEADERS"
>>    OUTPUT_VARIABLE qt_headers )
>>which reports itself again as qt4 and ensures that other checks don't find qt 3.2.1
>>
>>[I would like to use Qt3 even though Qt4 is installed (old projects, you know...). ]
>>
>>The find Qt code from there on will never find Qt3 no matter what you ask it to do, so and despite a remarkably long piece of code which checks QT_MAX_VERSION against the version found (which doesn't seem to do anything), it can't override the qt4 with qt3 because it never found it. In fact, if v4 is installed, it's unlikely one can find v3 without some intervention.
>>
>>I've therefore added a QT_SUGGESTED_PATH which can be set before calling FindQt. This will be searched before the other paths to help us get the version we want. [Only useful if you already know where it is, but one can add a gui option on a project by project as needs basis].
>>Unfortunately, even if we fooled cmake into finding Qt in our suggested place, later on, when FindQt3 is run, it also uses find_program - and so uic.exe and moc.exe from qt4 are picked up (groan!). I've added the suggested patch to them too.
>>
>>But to cap it off,
>>  FIND_PROGRAM(QT_QMAKE_EXECUTABLE NAMES qmake PATHS ${QT_USER_PATH}/bin $ENV{QTDIR}/bin)
>>should search qt user path before system paths (according to docs), but I had to add NO_SYSTEM_PATH for it to work. It turns out that systemtools is adding the sytem path before the user paths. Changing this may have repurcussions beyond this fix...
>>
>>JB
>>Attached are patches (cvs write access gone for me it seems).
>>
>>
>>    
>>




More information about the CMake mailing list