On Wednesday, July 29, 2015 04:05:41 PM Pascal Bach wrote: > Hi Clint > > Am 29.07.2015 um 15:45 schrieb Clinton Stimpson: > > Hi Pascal, > > > > Thanks for the patches. > > > > Can you share with us why setting CMAKE_FIND_ROOT_PATH does not work, or > > how this new method compares? > > > > For example, in the toolchain file: > > SET(CMAKE_FIND_ROOT_PATH /path/to/Qt ...) > > The problem is how FindQt4 does find the locations using qmake. > > let's assume there are two sysroots one is /sysroots/x86_64 which contains > binaries usable on the host machine, and there is /sysroots/arm which > contains libraries for the target system. this are both set via: > set( CMAKE_FIND_ROOT_PATH /sysroots/arm /sysroots/x86_64 ) > set( CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY ) > set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY ) > set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY ) > set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
Yes, this concern of 2 sysroots has been brought up before. Thanks for addressing this. > > Here is what happens when only setting CMAKE_FIND_ROOT_PATH: > > 1. FindQt4 is trying to find the qmake executable. As there is no qmake in > /sysroots/arm (it would not be runnable on the host) it will find qmake > from the /sysroots/x86_64 directory. 2. FindQt4 is asking qmake for the > path to the Qt installation. As the qmake found is the one from > /sysroots/x86_64 it will point to the libraries from /sysroots/x86_64 which > will obviously not run on arm! > > Currently I didn't find a way to override this behaviour of FindQt4, except > by setting all the variables usually set by FindQt4 manually. It is usually > accepted to set some variables manually when doing cross compilation. With > this patchset I tried to reduce this variable to a minumum and let FindQt4 > figure out the rest. > > The minimum variables required with the patch are: > > QT_BINARY_DIR is necessary to find the correct qmake > QT_LIBRARY_DIR is necessary to find the library directory > QT_INCLUDE_DIR is necessary to find the include directory (might be possible > to figure this out from QT_INCLUDE_DIR if some assumptions are made) > QT_MKSPECS_DIR necessary to have the correct prefixes (E in the case of > qt4-embedded). > > > I hope my explanation is clear. If there is a better way to achive this I'm > all ears. > I'm fine with this, and don't think it'll conflict with any other use cases. However, I do think we should first document setting CMAKE_FIND_ROOT_PATH, then afterwards document the other variables for those users which need more control. Does that sound reasonable? Clint > Pascal > > > Clint > > > > On Wednesday, July 29, 2015 02:32:48 PM Pascal Bach wrote: > >> --- > >> > >> Modules/FindQt4.cmake | 20 ++++++++++++++++++++ > >> 1 file changed, 20 insertions(+) > >> > >> diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake > >> index 9d03378..64c06e1 100644 > >> --- a/Modules/FindQt4.cmake > >> +++ b/Modules/FindQt4.cmake > >> @@ -29,6 +29,26 @@ > >> > >> # for a particular executable, set the ``QT4_NO_LINK_QTMAIN`` target > >> # property to ``TRUE`` on the executable. > >> # > >> > >> +# Cross Compile > >> +# ^^^^^^^^^^^^^ > >> +# > >> +# To find Qt in a cross compile environment set the following variables > >> in > >> your 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 > >> + > >> +# example > >> +# > >> +# :: > >> +# set( QT_BINARY_DIR /sysroots/x86_64-linux/usr/bin ) > >> +# set( QT_LIBRARY_DIR /sysroots/arm/usr/lib ) > >> +# set( QT_INCLUDE_DIR /sysroots/arm/usr/include/qtopia ) > >> +# set( QT_MKSPECS_DIR /sysroots/arm/usr/share/qtopia/mkspecs ) > >> +# > >> +# > >> > >> # Qt Build Tools > >> # ^^^^^^^^^^^^^^ > >> # -- 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