[CMake] Cross-compilation vs FindQt4.cmake

Andrey. ahippo at yandex.ru
Sat Jun 5 09:12:30 EDT 2010



03.06.10, 16:19, "Alexander Neundorf" <a.neundorf-work at gmx.net>:
>  > > This can be done by
>  > > - setting CMAKE_PREFIX_PATH so that it points to the base directory where
>  > > that qmake is installed
>  > > - setting QT_QMAKE_EXECUTABLE directly when running cmake:
>  > > cmake -DQT_QMAKE_EXECUTABLE=/your/qmake
>  >
>  > I've already mentioned, that I simply modify PATH variable as it works both
>  > for qmake and other tools. I don't like touching CMAKE_PREFIX_PATH, because
>  > then cmake will attempt to look for libraries in "${CMAKE_PREFIX_PATH}/lib"
>  > and can pick up libraries, compiled for host system. Also, I'm not sure,
>  > how well CMAKE_PREFIX_PATH would work together with CMAKE_FIND_ROOT_PATH.
>  >
>  > > How far do you get with this ?
>  >
>  > 1) FindQt4 finds my qmake
>  > 2) FindQt4 runs "qmake -query" or "qmake CMakeTmpQmake/tmp.pro"
>  > 3) FindQt4 gets, i.e.
>  > QT_INSTALL_LIBS:/I/configured/qmake/for/this/root/usr/lib/qt4 4) Obtained
>  > QT_INSTALL_DIR is wrong, because it may point to host libraries, required
>  > for moc, or somewhere else. 
>  
>  The directory reported for the libraries is also the wrong one, i.e. the one 
>  for the qmake which is currently running, right ?
Right.

>  Does the target Qt also have a qmake, moc and uic ?
No, there is no need for them.
They aren't supposed to be run on target machine.
Also, there is no reason of running them on host either.

But again, other cross-environments may have them.

>  Is there any relation (installation location-wise) between the moc and uic 
>  (and qmake) which have to be used and the location of the target Qt 
>  installation, i.e. the lib and include dirs ?
In general, no.
Any such relation is either quite cross-environment specific or non-existent.
For example,
1) moc and uic are located at /home/me/cross-devel/tools/bin
2) target lib dir is /home/me/cross-devel/build/my_internal_target_name/usr/lib

That is why, I do like the idea of using pkg-config:
1) .pc files are usually placed near libraries (${libexecdir}/pkgconfig)
2) It's easy to tell pkg-config the sysroot dir

-- 
Andrey Hippo.


More information about the CMake mailing list