[CMake] FindQt4 stubbornly finding Qt3

Clinton Stimpson clinton at elemtech.com
Tue May 19 01:24:33 EDT 2009


Zach Laine wrote:
> On Mon, May 18, 2009 at 4:57 PM, Clinton Stimpson <clinton at elemtech.com> wrote:
>   
>> # temp set of path to find desired Qt
>> export PATH=/usr/local/Trolltech/Qt-4.3.5/bin:$PATH
>> # create build dir
>> mkdir build ; cd build
>> # run cmake
>> cmake ../
>> # make
>> make
>>     
>
> As I originally said, I've already tried that:
>
>   
>>> I've renamed the qmake that comes installed on my system, and changed
>>> PATH and QTDIR env variables in an effort to get CMake to find the
>>> right version of Qt.  Any idea how I can fix my CMakeLists.txt and/or
>>> system to fix this problem?
>>>       
>
> It seems to find Qt 4.3.5, but then the QT_INCLUDE_DIR variable is
> still set to /usr/lib/qt3/include, and the make command line it
> generates is of the form:
>
> /usr/bin/c++   -g -I/usr/lib/qt3/include -I/usr/include/QtGui
> -I/usr/include/QtCore   -DQT_SHARED -DQT_GUI_LIB -DQT_CORE_LIB -o
> CMakeFiles/myexe.dir/window.o -c
> /ldisk/localstorage/proj/cmake/qt_test/window.cpp
>
>   
The only way I know how to do that is to include both Qt4 and Qt3.
find_package(Qt3)
find_package(Qt4)
....
which is not supported.
You even used the old Qt 3 macros in your original cmake snippet you gave.

What about a minimal CMakeLists.txt file?
===
find_package(Qt4)
message(${QT_INCLUDE_DIR})
===

Clint




More information about the CMake mailing list