On Monday 31 May 2010, Andrey. wrote: > >> I would like to know whether there is some progress on making > >> FindQt4.cmake friends with cross-compilation. > > > > Not much, unfortunately. > > Not a piece of good news. > > >> Writing to you, as you seems to be a maintainer of FindQt4.cmake in both > >> Cmake and KDE repositories. > > > > Well, Clinton Stimpson is the maintainer of FindQt4.cmake in CMake, and I > > mostly merge the fixes there to the version in KDE. > > So actually he's the maintainer, but I'm also not the completely wrong > > person here :-) > > Sorry, I misunderstood the commit history a little. > > >> Also, I'm interested to know, why FindQt4.cmake doesn't utilize > >> pkg-config for most introspection of Qt. Qt4 provides nice .pc files. > >> pkg-config has some built-in support for cross-compilation through > >> PKG_CONFIG_SYSROOT_DIR and PKG_CONFIG_LIBDIR while qmake doesn't. Simply > >> compiling qmake to be used during cross-compilation and compiling qmake > >> to return correct include/library paths are two different tasks. In > >> first case, qmake can be used for multiple cross-compilation > >> environments. > > > > In general, CMake tries not to rely on any additional external tools, and > > pkg-config is one of those tools. > > Instead of blindly relying on pkg-config, it may be used as a hint in some > complex situations like cross-compiling. And anyway, in case of Qt, CMake > relies on an external qmake, which is not itself required to be present at > compile time (in contrast to moc/uic). > > > I have (until now) never cross compiled anything with Qt. > > How does a typical Qt installation for cross compiling look like ? > > I guess it has native tools (qmake, moc, uic), etc. > > I think, the installation heavily differs depending on cross-compilation > environment used (buildroot, scratchbox, etc).
If I remember correctly, scratchbox means running a virtual machine, so from this POV building inside scratchbox is not cross compiling, and in that regard it shouldn't need anything special from cmake. Buildroot doesn't do that, right ? > 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. 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. 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 How far do you get with this ? > > When FindQt4.cmake is executed, it queries qmake for information. > > Does this also work for a cross-compilation installation of Qt ? > > What are the results of a FindQt4.cmake with a cross-compiling qmake ? > > If no special care is taken, FindQt4 finds qmake from host system that > returns information about host library ignoring CMAKE_FIND_ROOT_PATH (and > that's wrong). If PATH variable is modified appropriately, FindQt4 finds > specially compiled qmake with good version. It's possible to compile qmake > to return information, suitable for cross-compilation. But it's then > required to recompile qmake if a change prefix somewhere. > > >> Currently, I'm going to use simple FindQt4.cmake with some hardcoded > >> paths, that will override system wide one. > > It's worth mentioning, that I managed to successfully compile a qt4-based > application with such a hacked FindQt4.cmake with bunch of set() statements > and a couple of include() directives. Yes, what makes FindQt4.cmake big is all the flexibility to find everything for the different versions on the different OSs. It started small... Alex _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake