FindQt4 depends a lot on QMake for finding the correct Qt path. This doesn't work well in cross compile environments as qmake reports the location of the native library.
This patch allows to do cross compilation by setting the following variables for example in the toolchain file. QT_BINARY_DIR => Path to native Qt binary directory QT_LIBRARY_DIR => Path to target Qt library directory QT_INCLUDE_DIR => Path to target Qt include directory QT_MKSPECS_DIR => Path to target Qt mkspecs directory Signed-off-by: Pascal Bach <pascal.b...@siemens.com> --- Modules/FindQt4.cmake | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index 14404fa..9d03378 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -583,23 +583,23 @@ if (QT_QMAKE_EXECUTABLE AND set(QT_QTCORE_LIBRARY_DEBUG NOTFOUND) find_library(QT_QTCORE_LIBRARY_RELEASE NAMES QtCore${QT_LIBINFIX} QtCore${QT_LIBINFIX}4 - HINTS ${QT_LIBRARY_DIR_TMP} + HINTS ${QT_LIBRARY_DIR} ${QT_LIBRARY_DIR_TMP} NO_DEFAULT_PATH ) find_library(QT_QTCORE_LIBRARY_DEBUG NAMES QtCore${QT_LIBINFIX}_debug QtCore${QT_LIBINFIX}d QtCore${QT_LIBINFIX}d4 - HINTS ${QT_LIBRARY_DIR_TMP} + HINTS ${QT_LIBRARY_DIR} ${QT_LIBRARY_DIR_TMP} NO_DEFAULT_PATH ) if(NOT QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTCORE_LIBRARY_DEBUG) find_library(QT_QTCORE_LIBRARY_RELEASE NAMES QtCore${QT_LIBINFIX} QtCore${QT_LIBINFIX}4 - HINTS ${QT_LIBRARY_DIR_TMP} + HINTS ${QT_LIBRARY_DIR} ${QT_LIBRARY_DIR_TMP} ) find_library(QT_QTCORE_LIBRARY_DEBUG NAMES QtCore${QT_LIBINFIX}_debug QtCore${QT_LIBINFIX}d QtCore${QT_LIBINFIX}d4 - HINTS ${QT_LIBRARY_DIR_TMP} + HINTS ${QT_LIBRARY_DIR} ${QT_LIBRARY_DIR_TMP} ) endif() @@ -659,13 +659,13 @@ if (QT_QMAKE_EXECUTABLE AND _qt4_query_qmake(QT_INSTALL_HEADERS qt_headers) set(QT_QTCORE_INCLUDE_DIR NOTFOUND) find_path(QT_QTCORE_INCLUDE_DIR QtCore - HINTS ${qt_headers} ${QT_LIBRARY_DIR} + HINTS ${QT_INCLUDE_DIR} ${qt_headers} ${QT_LIBRARY_DIR} PATH_SUFFIXES QtCore qt4/QtCore NO_DEFAULT_PATH ) if(NOT QT_QTCORE_INCLUDE_DIR) find_path(QT_QTCORE_INCLUDE_DIR QtCore - HINTS ${qt_headers} ${QT_LIBRARY_DIR} + HINTS ${QT_INCLUDE_DIR} ${qt_headers} ${QT_LIBRARY_DIR} PATH_SUFFIXES QtCore qt4/QtCore ) endif() -- 1.9.1 -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers