[CMake] Override find_package path for qt / multiarchitecture build windows 64 and windows 32

Clinton Stimpson clinton at elemtech.com
Fri Feb 25 12:05:08 EST 2011


Yeah, that works too.
I thought it would be nice to encourage CMAKE_PREFIX_PATH which should work 
with any cmake find module.

I was easily able to control which Qt was found by modifying "myqt" below

#file(TO_CMAKE_PATH "$ENV{USERPROFILE}/qt/qt-4.5.2-2008-64" myqt)
file(TO_CMAKE_PATH "$ENV{USERPROFILE}/qt/qt-4.5.2-2008-32" myqt)
SET(CMAKE_PREFIX_PATH ${myqt} ${CMAKE_PREFIX_PATH})
find_package(Qt4)

The system loader distinguishes 32 from 64 bit, so you can put both Qt bin 
directories in your PATH.

Clint

On Friday, February 25, 2011 09:41:35 am David Cole wrote:
> Just:
> 
>   set( QT_QMAKE_EXECUTABLE ${QT_BINARY_DIR}/qmake.exe )
> 
> should be sufficient here. Everything else that FindQt does switches off of
> the qmake setting... If you change the qmake executable, all the other
> variables will adapt correctly.
> 
> 
> On Fri, Feb 25, 2011 at 10:21 AM, Thomas Wolf
> <thomas.wolf at vision.ee.ethz.ch
> 
> > wrote:
> > 
> > follow up:
> > 
> > with an additional:
> >                set( QT_INCLUDE_DIR $ENV{QTDIR}/include )
> >                set( QT_HEADERS_DIR $ENV{QTDIR}/include )
> >                set( QT_LIBRARY_DIR $ENV{QTDIR}/lib )
> >                set( QT_BINARY_DIR $ENV{QTDIR}/bin )
> >                set( QT_LIBRARY_DIR_TMP ${QT_LIBRARY_DIR} )
> >                set( QT_QMAKE_EXECUTABLE ${QT_BINARY_DIR}/qmake.exe )
> >                find_package(Qt4 COMPONENTS QtCore QtGui REQUIRED )
> > 
> > <<<
> > 
> > it seems to work. I keep you updated. On a sidenote, i discovered your
> > bug request for cmake 2.8.3 regarding this topic.
> > 
> > With PATH and CMAKE_PREFIX_PATH i did not succeed so far..
> > 
> > Still the question remins open, how the systems loader can find the
> > proper dll versions... does QT have proper embedded manifests with the
> > loader beeing able to distinguish between 64bit and 32bit? in that case,
> > the QTDIR/bin for 32 bit and QTDIR64/bin for 64 bit can both be put into
> > the system's environment path..
> > 
> > Have a nice weekend,
> > Thomas
> > _______________________________________________
> > 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


More information about the CMake mailing list