[CMake] Cross-compilation vs FindQt4.cmake

Alexander Neundorf a.neundorf-work at gmx.net
Thu Jun 3 08:19:43 EDT 2010


On Tuesday 01 June 2010, Andrey. wrote:
...
> Right, buildroot doesn't use virtual machines.
> It compiles cross-toolchain, some tools and then use them to compile
> packages for target system.
>
> > > Currently, I'm using some
> > > hand-written environment, mostly resembling buildroot. It consists of:
> > > 1) host system with general native libraries and utilities;
> > > 2) cross-compiled libraries and executables for target system placed at
> > > some prefix; 3) special tools, required for cross-compilation and
> > > related stuff (cross-toolchain, qmake, image/firmware generators go
> > > here).
> > >
> > > Tools at item 3) usually must match specific requirements on version
> > > used. In case of Qt, I have statically compiled qmake, moc, uic,
> > > lrelease, etc against exactly the same version of Qt used for target
> > > system.
> >
> > So this seems to be the actual crosscompiling case.
>
> Right.
>
> > If you want to use a specific version of Qt, you have to make sure cmake
> > finds the qmake for the Qt you want to use.
>
> That's clear.
>
> > 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 ?

> 5) Qt4-based application fails to build because
> of incorrect libraries, supplied for linkage.

Ok.

Does the target Qt also have a qmake, moc and uic ?

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 ?

Alex


More information about the CMake mailing list