[CMake] How pass a -spec parameter to FindQt4.cmake?

clinton@elemtech.com clinton at elemtech.com
Mon Jul 18 10:23:26 EDT 2011


What version of cmake are you using? And since you are cross-compiling, what does your toolchain file for cmake look like?  Did you add a find path in that file for your powerpc libs?
The spec file only applies on qmake generated makefiles, which is not happening when using cmake.
And you do not need to build your own qmake.

Clint

----- Reply message -----
From: "Daniel Näslund" <dannas at dannas.name>
Date: Mon, Jul 18, 2011 12:12 am
Subject: [CMake] How pass a -spec parameter to FindQt4.cmake?
To: <cmake at cmake.org>

Hi!

I'm trying to cross-compile a Qt-application for the powerpc platform.
CMake looks for the Qt libraries in the wrong place - it finds the host
libraries instead of the target libraries:

    Warning: QT_QMAKE_EXECUTABLE reported QT_INSTALL_LIBS as /usr/lib
    Warning: But QtCore couldn't be found.  Qt must NOT be installed
correctly, or it wasn't found for cross compiling.
    CMake Error at /usr/share/cmake-2.8/Modules/FindQt4.cmake:642 (MESSAGE):
      Could NOT find QtCore.  Check /tmp/tmp8VJ3jw/CMakeFiles/CMakeError.log for
      more details.
    Call Stack (most recent call first):
      CMakeLists.txt:60 (find_package)

My powerpc libs are located in /opt/env/ppc/usr/lib.

When I read FindQt4.cmake I see that CMake uses QMake for finding out
where the Qt libs reside using "qmake -query".

Is there an easy way to let CMake tell QMake about what platform we want
to build for? I've tried...

...Using an environment variable
    $ QMAKESPEC=qws/linux-powerpc-g++ cmake

...Using a shell wrappper
    $ cat <<END > ~/bin/qmake
    #!/bin/sh

    qmake -spec qws/linux-ppc-g++ -query $*
    END
    $ cmake

The environment variable didn't make any difference and the shell wrapper
failed since qmake didn't allow the -spec and -query flag to be passed
simultaneously.

All of the three resources below suggests that compiling my own version
of qmake is the way to go but to me it sounds a bit counter-intuitive;
why would cmake not allow me to pass a -spec parameter to qmake?

http://www.linuxjournal.com/content/cross-compiling-qt
http://www.cmake.org/pipermail/cmake/2010-June/037239.html
http://www.trinitydesktop.org/docs/qt4/qt-embedded-crosscompiling.html

--

Thanks,
Daniel Näslund
_______________________________________________
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110718/a7293f21/attachment.htm>


More information about the CMake mailing list