>
> 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.
>
Hello,
thanks for the reply! It seems that it is the info I was looking for.
But till now i still did not succeed. Beforehand I have to mention that
i strongly oppose to standard path additons or environment variables to
make builds run, because i believe builds should run out of the box.
In that case, however, i think an exception is appropriate. Or to be
more specific, the build should set the environment or the variables by
itself, and leave the system as it is. This should work, because after
config phase, CMAKE has all its path in the cache, right?
So, this is what i came up with today:
snip --------------------------->
if( ${HAVE_64_BIT} )
if( EXISTS $ENV{QTDIR64} )
MESSAGE( STATUS "* detected QTDIR64 variable with: $ENV{QTDIR64}" )
#redirect
SET( ENV{QTDIR} $ENV{QTDIR64} )
SET( ENV{PATH} "$ENV{PATH};$ENV{QTDIR64}/bin" )
MESSAGE( STATUS "* redirected QTDIR variable to: $ENV{QTDIR}" )
MESSAGE( STATUS " " )
MESSAGE( STATUS "* PATH: $ENV{PATH}" )
MESSAGE( STATUS " " )
#set prefix path
SET(CMAKE_PREFIX_PATH "$ENV{QTDIR64} ${CMAKE_PREFIX_PATH}" )
MESSAGE( STATUS "* CMAKE_PREFIX_PATH: ${CMAKE_PREFIX_PATH}" )
#NO_CMAKE_PACKAGE_REGISTRY NO_SYSTEM_ENVIRONMENT_PATH PATHS
$ENV{QTDIR64}}
FIND_PACKAGE(Qt4 REQUIRED HINT $ENV{QTDIR64}/bin )
else( EXISTS $ENV{QTDIR64} )
MESSAGE ( FATAL_ERROR " !! ARCHITECTURE detected as 64 bit, but no
QTDIR64 found in environment. Aborting !!")
endif( EXISTS $ENV{QTDIR64} )
else( ${HAVE_64_BIT} )
SET( ENV{PATH} "$ENV{PATH};$ENV{QTDIR}/bin" )
MESSAGE( STATUS " " )
MESSAGE( STATUS "* PATH: $ENV{PATH}" )
MESSAGE( STATUS " " )
FIND_PACKAGE(Qt4 REQUIRED)
endif ( ${HAVE_64_BIT} )
< --------------------------- snap
In the 64 bit console, cmake indeed goes to the QTDIR64 branch, and
QTDIR is set to QTDIR64, and as enforcing every chance i get ( :) ) for
the correct path, i set CMAKE_PREFIX_PATH to the QTDIR64 value. AND i
add it tio the path.. Specifically, I removed the 32bit QTDIR from the
stanard PATH.
*but*
..it does not work yet. So what is wrong? My output is still:
snip --------------------------->
-- * detected QTDIR64 variable with: C:\Libs\Qt\4.7.1_vc9_x64
-- * redirected QTDIR variable to: C:\Libs\Qt\4.7.1_vc9_x64
--
-- * PATH:
--
-- * CMAKE_PREFIX_PATH: C:\Libs\Qt\4.7.1_vc9_x64
-- QT_USE_FILE: C:/Program Files (x86)/CMake
2.8/share/cmake-2.8/Modules/UseQt4.cmake
--
-- QT_QTMAIN_LIBRARY_DEBUG: C:/Libs/Qt/4.7.1_vc9/lib/qtmaind.lib
-- QT_QTMAIN_LIBRARY_RELEASE: C:/Libs/Qt/4.7.1_vc9/lib/qtmain.lib
-- QT_LIBRARY_RELEASE:
-- QT_LIBRARY_DEBUG:
--
-- current include: C:/Libs/Qt/4.7.1_vc9/include
-- current lib:
-- definitions: -DQT_DLL
-- CMAKE_CONFIGURATION_TYPES: DebugReleaseMinSizeRelRelWithDebInfo
-- CMAKE_BUILD_TYPE:
-- * done.
< --------------------------- snap
Note that i stripped the path output from my console output for sake of
readability, but there is no reference to qt, which i double checked.
So, what did i miss?
Regards,
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