When cross compiling, only some the qmake queries are actually used. &nbsp;<br><br>Finding the rest just works if subdirs in the Qt installation weren&#39;t given different values when running Qt&#39;s configure script (e.g. --libdir=mylib or --libdir=lib/qt4).<br><br>So, the root of the Qt installation needs to be given in the toolchain file. &nbsp;Is /opt/env/lenny-ppc/usr/lib/qt4 the root of the installation, or the location of the libraries? &nbsp;In either case, it won&#39;t be searched unless you put that in your toolchain file. &nbsp;The standard cross compile find variables are the global variables you can setto help find Qt.<br><br>Then, if you need to help it some more, you may set the path to the QtCore library manually, or other variables manually.<br><br>If lib/qt4 is another path that should be searched automatically, let us know, and we can add it to FindQt4.cmake.<br><br>Clint<br><br>----- Reply message -----<br>From: &quot;Daniel Näslund&quot; &lt;dannas@dannas.name&gt;<br>Date: Mon, Jul 18, 2011 11:50 am<br>Subject: [CMake] How pass a -spec parameter to FindQt4.cmake?<br>To: &quot;clinton@elemtech.com&quot; &lt;clinton@elemtech.com&gt;<br>Cc: &lt;cmake@cmake.org&gt;<br><br><br>On Mon, Jul 18, 2011 at 07:23:26AM -0700, clinton@elemtech.com wrote:<br>&gt; What version of cmake are you using? <br><br>$ cmake --version<br>cmake version 2.8.4<br><br>&gt; And since you are cross-compiling, what does your toolchain file for<br>&gt; cmake look like? &nbsp;<br><br>The contents of my toolchain.cmake file:<br><br> &nbsp; &nbsp;set(CMAKE_SYSTEM_NAME Linux)<br> &nbsp; &nbsp;set(CROSSPREFIX /opt/crosstool/gcc-4.2.0-glibc-2.5/powerpc-603-linux-gnu)<br><br> &nbsp; &nbsp;set(CMAKE_C_COMPILER &nbsp; ${CROSSPREFIX}/bin/powerpc-603-linux-gnu-gcc)<br> &nbsp; &nbsp;set(CMAKE_CXX_COMPILER ${CROSSPREFIX}/bin/powerpc-603-linux-gnu-g++)<br> &nbsp; &nbsp;set(CMAKE_LINKER &nbsp; &nbsp; &nbsp; ${CROSSPREFIX}/bin/powerpc-603-linux-gnu-ld)<br><br> &nbsp; &nbsp;set(CMAKE_FIND_ROOT_PATH ${CROSSPREFIX}/lib<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /opt/env/lenny-ppc/lib<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /opt/env/lenny-ppc/usr/lib)<br><br> &nbsp; &nbsp;set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)<br> &nbsp; &nbsp;set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)<br> &nbsp; &nbsp;set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)<br><br>The part of my CMakeLists.txt that tries to find a Qt installation:<br><br> &nbsp; &nbsp;if (USE_QT)<br> &nbsp; &nbsp; &nbsp; &nbsp;message(STATUS &quot;Build support for QT is enabled.&quot;)<br> &nbsp; &nbsp; &nbsp; &nbsp;find_package(Qt4 4.4 COMPONENTS QtCore QtDbus REQUIRED)<br> &nbsp; &nbsp; &nbsp; &nbsp;set(CMAKE_CXX_FLAGS &quot;${CMAKE_CXX_FLAGS} -DHAS_QT&quot;)<br> &nbsp; &nbsp; &nbsp; &nbsp;include(${QT_USE_FILE})<br> &nbsp; &nbsp;else()<br> &nbsp; &nbsp; &nbsp; &nbsp;message(STATUS &quot;Build support for QT is disabled.&quot;)<br> &nbsp; &nbsp;endif (HAS_QT)<br><br>&gt; Did you add a find path in that file for your powerpc libs? &nbsp;<br><br>Since the libs are located in /opt/env/lenny-ppc/usr/lib/qt4 I expect<br>that this line taken from the toolchain file above is sufficient:<br><br> &nbsp; &nbsp;set(CMAKE_FIND_ROOT_PATH ${CROSSPREFIX}/lib<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /opt/env/lenny-ppc/lib<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /opt/env/lenny-ppc/usr/lib)<br><br>&gt; The spec file only applies on qmake generated makefiles, which is not<br>&gt; happening when using cmake. &nbsp;<br><br>Ah, <br><br>&gt; And you do not need to build your own qmake.<br><br>Ok. But I don&#39;t see how I can make qmake return the right information.<br>Here&#39;s the function in FindQt4.cmake that is used for querying qmake:<br><br> &nbsp; &nbsp;function(_QT4_QUERY_QMAKE VAR RESULT)<br> &nbsp; &nbsp; &nbsp;exec_program(${QT_QMAKE_EXECUTABLE} ARGS &quot;-query ${VAR}&quot; RETURN_VALUE return_code OUTPUT_VARIABLE output )<br> &nbsp; &nbsp; &nbsp;if(NOT return_code)<br> &nbsp; &nbsp; &nbsp; &nbsp;file(TO_CMAKE_PATH &quot;${output}&quot; output)<br> &nbsp; &nbsp; &nbsp; &nbsp;set(${RESULT} ${output} PARENT_SCOPE)<br> &nbsp; &nbsp; &nbsp;endif(NOT return_code)<br> &nbsp; &nbsp;endfunction(_QT4_QUERY_QMAKE)<br><br>I don&#39;t see anywhere that it relies upon some variable that I can change<br>in order to have it point at the target Qt4 installation. Is there some<br>global variable involved for setting the base directory or something<br>similar?<br><br>Daniel<br><br><br>