Hi, there!<br>I am try to cross compilation qt5 apps on Linux.<br>By this wiki point: <a href="http://www.cmake.org/Wiki/CmakeMingw">http://www.cmake.org/Wiki/CmakeMingw</a><br>I can make the simple qt5 demo works.<br><br>

main.cpp<br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">#include &lt;QApplication&gt;<br>#include &lt;QLabel&gt;<br><br>int main(int argc, char *argv[])<br>

{<br>    QApplication a(argc, argv);<br>    QLabel *label = new QLabel(&quot;Hello World&quot;);<br>    label-&gt;show();<br>    int i;<br>    return a.exec();<br>}<br></blockquote><br>CMakeLists.txt<br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">

cmake_minimum_required(VERSION 2.8.9 FATAL_ERROR)<br><br>project(testproject)<br><br># Find includes in corresponding build directories<br>set(CMAKE_INCLUDE_CURRENT_DIR ON)<br># Instruct CMake to run moc automatically when needed<br>

set(CMAKE_AUTOMOC ON)<br><br># Find the QtWidgets library<br>find_package(Qt5Widgets)<br><br># Tell CMake to create the helloworld executable<br>add_executable(helloworld main.cpp)<br><br># Use the Widgets module from Qt 5<br>

qt5_use_modules(helloworld Widgets)<br></blockquote><br clear="all"><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">loaden@qpsoft:~/qpSOFT/Projects/demo/m64$ cmake .. -DCMAKE_PREFIX_PATH=/home/loaden/qpSOFT/Projects/BuildQt5-m64/qtbase -DCMAKE_TOOLCHAIN_FILE=~/.mingw64.cmake<br>

-- The C compiler identification is GNU 4.7.1<br>-- The CXX compiler identification is GNU 4.7.1<br>-- Check for working C compiler: /opt/mingw64/bin/x86_64-w64-mingw32-gcc<br>-- Check for working C compiler: /opt/mingw64/bin/x86_64-w64-mingw32-gcc -- works<br>

-- Detecting C compiler ABI info<br>-- Detecting C compiler ABI info - done<br>-- Check for working CXX compiler: /opt/mingw64/bin/x86_64-w64-mingw32-g++<br>-- Check for working CXX compiler: /opt/mingw64/bin/x86_64-w64-mingw32-g++ -- works<br>

-- Detecting CXX compiler ABI info<br>-- Detecting CXX compiler ABI info - done<br>-- Configuring done<br>-- Generating done<br>-- Build files have been written to: /home/loaden/qpSOFT/Projects/demo/m64<br>loaden@qpsoft:~/qpSOFT/Projects/demo/m64$ make<br>

Scanning dependencies of target helloworld_automoc<br>[ 33%] Automoc for target helloworld<br>[ 33%] Built target helloworld_automoc<br>Scanning dependencies of target helloworld<br>[ 66%] Building CXX object CMakeFiles/helloworld.dir/main.cpp.obj<br>

[100%] Building CXX object CMakeFiles/helloworld.dir/helloworld_automoc.cpp.obj<br>Linking CXX executable helloworld.exe<br>[100%] Built target helloworld<br></blockquote><br>When I try another demo, it&#39;s failed, and I can&#39;t find the reason.<br>

CMakeLists.txt<br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">cmake_minimum_required(VERSION 2.8.9 FATAL_ERROR)<br><br>project(testproject)<br>
<br>
# Find includes in corresponding build directories<br>set(CMAKE_INCLUDE_CURRENT_DIR ON)<br># Instruct CMake to run moc automatically when needed<br>set(CMAKE_AUTOMOC ON)<br><br># Find the QtWidgets library<br>find_package(Qt5Widgets REQUIRED)<br>

<br># Tell CMake to create the helloworld executable<br>add_executable(helloworld<br>    main.cpp<br>    mainwindow.cpp<br>    mainwindow.ui<br>)<br><br># Use the Widgets module from Qt 5<br>qt5_use_modules(helloworld Widgets)<br>

<br># Support UI files<br>qt5_wrap_ui(ui_mainwindow.h mainwindow.ui)<br></blockquote><br>I can sure this project can be build for Linux target.<br>It&#39;s just failed for cross build.<br><br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">

loaden@qpsoft:~/qpSOFT/Projects/qtdemo/m64$ cmake .. -DCMAKE_PREFIX_PATH=/home/loaden/qpSOFT/Projects/BuildQt5-m64/qtbase -DCMAKE_TOOLCHAIN_FILE=~/.mingw64.cmake<br>-- The C compiler identification is GNU 4.7.1<br>-- The CXX compiler identification is GNU 4.7.1<br>

-- Check for working C compiler: /opt/mingw64/bin/x86_64-w64-mingw32-gcc<br>-- Check for working C compiler: /opt/mingw64/bin/x86_64-w64-mingw32-gcc -- works<br>-- Detecting C compiler ABI info<br>-- Detecting C compiler ABI info - done<br>

-- Check for working CXX compiler: /opt/mingw64/bin/x86_64-w64-mingw32-g++<br>-- Check for working CXX compiler: /opt/mingw64/bin/x86_64-w64-mingw32-g++ -- works<br>-- Detecting CXX compiler ABI info<br>-- Detecting CXX compiler ABI info - done<br>

-- Configuring done<br>-- Generating done<br>-- Build files have been written to: /home/loaden/qpSOFT/Projects/qtdemo/m64<br>loaden@qpsoft:~/qpSOFT/Projects/qtdemo/m64$ make<br>Scanning dependencies of target helloworld_automoc<br>

[ 20%] Automoc for target helloworld<br>Generating moc_mainwindow.cpp<br>No such file or directory<br>AUTOMOC: error: process for /home/loaden/qpSOFT/Projects/qtdemo/m64/moc_mainwindow.cpp failed:<br>No such file or directory<br>

moc failed...<br>make[2]: *** [CMakeFiles/helloworld_automoc] Error 1<br>make[1]: *** [CMakeFiles/helloworld_automoc.dir/all] Error 2<br>make: *** [all] Error 2<br><br></blockquote><br>-- <br><div>Best Regards</div>
<div>Yuchen</div><br>