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

Clinton Stimpson clinton at elemtech.com
Thu Feb 24 11:33:38 EST 2011


On Thursday, February 24, 2011 09:16:42 am Thomas Wolf wrote:
> Dear all,
> 
> i want my build system for our project (several heavy libraries) to
> build both 32 and 64 bit windows versions. Everything is integrated and
> working, except one thing:
> 
> QT 4.7 is used, but installed independently (standard library, not
> committed to repository). So everyone has it installed on their
> machines. The thing is, there are no 64 bit builds by trolltech, so
> everyone has to manually compile it (or create an external project in
> cmake) - but thats fine, except that the installer of the prebuilt 32
> bit version creates registry keys whereas the manually 64 bit version
> apparently does not.
> 
> The cmake build files now detect very nicely with my scripts if i create
> the visual studio 2008 solution file under 32 bit or 64 bit
> architecture. For 64 bit I definied an environment variable "QTDIR64"
> where the build shoud look into when requested as 64 bit build.
> 
> Now my problem is:
> How can i *override *FIND_PACKAGE(QT) to use an additionally defined
> path, be it environment variable or not? The find_qt cmake file at first
> looks into the registry keys and therefore always find the 32 bit
> version...
> 
> Is there a way to force the qt detection mechanism into using my
> directory which i missed or do i have to write my own modified
> find_package for qt?
> 

Sure, the find_program() call in FindQt4.cmake has registry keys first, but if 
you look at the docs for find_program(), all of those paths are looked at last.

The CMAKE_PREFIX_PATH and PATH variables have a higher priority, and you can 
set those to control which Qt you want found.

-- 
Clinton Stimpson
Elemental Technologies, Inc
Computational Simulation Software, LLC
www.csimsoft.com


More information about the CMake mailing list