[cmake-developers] [PATCH 3/3] FindQt4: document cross compilation

Pascal Bach pascal.bach at siemens.com
Thu Jul 30 09:29:03 EDT 2015


Hi again

Am 30.07.2015 um 10:54 schrieb Pascal Bach:
> Hi Clint, Hi Brad
>> 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.
> That sounds reasonable.
>> 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.
> Brads suggestion doesn't work as it again finds the native Qt version.
>
>  I think the proper way might be for CMake to be aware of that one sysroot is native and the other one is for the target.
> so find_program would look in the native one and the other find_* functions would look in the target sysroot.
>
> I'm not sure how this could be achived?
I gave this some additional tought and maybe the soltuion would be to solve this on a lower level within CMake.

Here is an idea:

In additiona to CMAKE_SYSROOT we could add a CMAKE_HOST_SYSROOT.
CMAKE_HOST_SYSROOT is by default set to the normal host path but could be changed in a case like we have for FindQt4.

CMAKE_FIND_ROOT_PATH_MODE would then need to be extended to support something like NATIVE and TARGET that one could use to choose where to look for files.
This way every find_* call could explicitly tell if it wants a host or a target version.
find_program by defaul would prefer NATIVE while find_library etc. would prefer TARGET, but this could be changed per call if necessary.


With this changes I think the implementation for FindQt4 and maybe others could be simplified.
Also CMakeLists.txt for cross compiled projects would be easier.

Would this be a feasible extension?


PS: It looks kind of similar to what was done with CMAKE_APPBUNDLE_PATH for Mac OS X, but I haven't look deeper into how this works.

Pascal


More information about the cmake-developers mailing list