find_package(Qt4)
include(${QT_USE_FILE})
qt4_wrap_cpp(MOC_FILES slidersgroup.h window.h)
add_executable(myexe main.cpp slidersgroup.cpp window.cpp ${MOC_FILES})
# 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
So for command line cmake, you set PATH or add a -D flag to cmake with
the qmake you want to use.
With cmake-gui, it becomes interactive, and you can just fix what you
don't like.
BTW, only Qt 3 recognizes QTDIR, unless you want to use it yourself for
convenience.
Clint
Zach Laine wrote:
I'm having a problem with FindQt*. I have numerous versions of Qt4 installed:
usr/local/Trolltech/Qt-4.1.1
/usr/local/Trolltech/Qt-4.1.5
/usr/local/Trolltech/Qt-4.2.3
/usr/local/Trolltech/Qt-4.3.5
/usr/local/Trolltech/Qt-4.4.3
/usr/local/Trolltech/Qt-4.5.0-rc1
As well as the stock versions of Qt3 and Qt4 that came with my distro
in /usr/lib.
I've written a simple CMakeLists.txt for one of the Qt examples, based
on recommendations about a seemingly related problem in this thread:
http://www.cmake.org/pipermail/cmake/2009-March/027702.html
Here is the file:
=========================================================
cmake_minimum_required(VERSION 2.4)
set(CMAKE_VERBOSE_MAKEFILE "YES")
set(DESIRED_QT_VERSION 4)
set(QT_QT_LIBRARY "")
set(QT_QMAKE_EXECUTABLE /usr/local/Trolltech/Qt-4.3.5/bin/qmake)
find_package(Qt4)
include(${QT_USE_FILE})
message(${QT_LIBRARY_DIR}) # prints "/usr/lib"
message(${QT_INCLUDE_DIR}) # prints "/usr/lib/qt3/include"
qt_wrap_cpp(DUMMY_LIB_NAME MOC_FILES slidersgroup.h window.h)
add_executable(myexe main.cpp slidersgroup.cpp window.cpp ${MOC_FILES})
target_link_libraries(myexe ${QT_LIBRARIES})
=========================================================
The result of running "cmake CMakeLists.txt ; make" for CMake versions
2.6.4, 2.6.3, 2.6.2, 2.6.0, and 2.4.8 all produce the output in lines
(1) and (2). CMake 2.4.8 additionally reports "-- Found Qt-Version
4.3.5"(!).
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?
Thanks in advance.
Zach Laine
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake