On Wednesday, July 29, 2015 04:59:57 PM Pascal Bach wrote: > Hi Clint > > Am 29.07.2015 um 16:47 schrieb Clinton Stimpson: > > 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. > I don't see a conflict either. > > > 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? > > I'm not sure I understand what you mean. > I think how to set CMAKE_FIND_ROOT_PATH is already documented in cmake. > Are you suggesting extending the docuemntation of FindQt4below with a > paragraph documenting how to work with two sysroots? With an example like > this? > > 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 )
What I want to avoid is users thinking that what you are proposing overrides any other way of finding Qt when cross compiling. The wording you propose is "To find Qt in a cross compile environment set the following variables" However there are users for which setting only CMAKE_FIND_ROOT_PATH is enough. Or setting CMAKE_FIND_ROOT_PATH plus QT_QMAKE_EXECUTABLE is enough. Brad had a good question in another email. Can't you set QT_QMAKE_EXECUTABLE? My guess, is no, because that qmake returns paths under one sysroot. I just realized something. Your use case is similar or the same to one I had tested FindQt4 with. Your Qt appears to be prefixed under /sysroot/arm/usr, not /sysroot/arm. Can you include /sysroot/arm/usr in CMAKE_FIND_ROOT_PATH, then see if FindQt4 can find your libraries under /sysroot/arm/usr. Clint -- 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