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

Daniel Näslund dannas at dannas.name
Fri Jul 22 01:48:04 EDT 2011


On Thu, Jul 21, 2011 at 7:00 PM,  <clinton at elemtech.com> wrote:
>> Managed to compile and link when I added the following snippet to the
>> toolchain file:
>>
>>     set(QT_HEADERS_DIR /opt/env/lenny-ppc/usr/lib)
>>     set(QT_LIBRARY_DIR /opt/env/lenny-ppc/usr/include/qt4)
>>
>>     set(QT_QTCORE_LIBRARY /opt/env/lenny-ppc/usr/lib/libQtCore.so)
>>     set(QT_QTCORE_LIBRARY_RELEASE
>>     /opt/env/lenny-ppc/usr/lib/libQtCore.so)
>>     set(QT_QTCORE_INCLUDE_DIR /opt/env/lenny-ppc/usr/include/qt4)
>>
>>     set(QT_QTDBUS_LIBRARY /opt/env/lenny-ppc/usr/lib/libQtDBus.so)
>>     set(QT_QTDBUS_LIBRARY_RELEASE
>>     /opt/env/lenny-ppc/usr/lib/libQtDBus.so)
>>     set(QT_QTDBUS_INCLUDE_DIR /opt/env/lenny-ppc/usr/include/qt4)
>>
>>     set(QT_QTXML_LIBRARY /opt/env/lenny-ppc/usr/lib/libQtXml.so)
>>     set(QT_QTXML_LIBRARY_RELEASE
>>     /opt/env/lenny-ppc/usr/lib/libQtXml.so)
>>     set(QT_QTXML_INCLUDE_DIR /opt/env/lenny-ppc/usr/include/qt4)
>>
>> Would have been nice if I didn't have to set those paths explicitely.
>> Will continue the digging.
>
> Does it work if you only specify just this:
>    set(QT_HEADERS_DIR /opt/env/lenny-ppc/usr/include/qt4)
>    set(QT_QTCORE_LIBRARY_RELEASE  /opt/env/lenny-ppc/usr/lib/libQtCore.so)

Unfortunately no. I get:

    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/tmpMm5uhv/CMakeFiles/CMakeError.log for
      more details.

> And I would have thought it can find QtCore if /opt/env/lenny-ppc/usr
> was given as a find root.  No?

Adding /opt/env/lenny-ppc/usr causes Pkg-config to choke:

    -- checking for module 'ecco-sqlite-1.12'
    /opt/env/lenny-ppc/usr/bin/pkg-config: 1: Syntax error: "(" unexpected
    --   package 'ecco-sqlite-1.12' not found
    CMake Error at
/usr/share/cmake-2.8/Modules/FindPkgConfig.cmake:266 (message):
      A required package was not found
    Call Stack (most recent call first):
      /usr/share/cmake-2.8/Modules/FindPkgConfig.cmake:320
(_pkg_check_modules_internal)
      CMakeLists.txt:51 (pkg_check_modules)

This happens for each of the libraries we're trying to detect with
PkgConfig.

Adding /opt/env/lenny-ppc/usr/share/qt4 to CMAKE_FIND_ROOT_PATH gives:

-- Found Qt-Version 4.6.3 (using /usr/bin/qmake)
CMake Error: The following variables are used in this project, but
they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the
CMake files:
QT_QTCORE_INCLUDE_DIR (ADVANCED)
   used as include directory in directory /home/dannas/bigsister_775

Trying to prefix the PATH enviroment variable with
/opt/env/lenny-ppc/usr/share/qt4 gives the same result.

Daniel


More information about the CMake mailing list