[cmake-developers] [PATCH 2/3] FindQt4: improve cross compile support
Pascal Bach
pascal.bach at siemens.com
Wed Jul 29 08:32:47 EDT 2015
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.bach at 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
More information about the cmake-developers
mailing list