Cross-Compiling with CMake and QtCreator

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Cross-Compiling with CMake and QtCreator

Thorsten Hofer-Schmitz
Hi,

I want to compile a program for Android. I work on Windows 10. Because I
recently reinstalled my OS everything isn't older than two month. I
Installed everything using Qt's, Android Studio's (and for Windows
Visual Studio's) installers/SDK Manager, to prevent mistakes I might
have made.

I'm not new to programming, but I haven't worked much with build systems
until now, alsways used what QtCreator/VS offers. But I want to do more
and after some research I decided to go with CMake.

So I made a new project in QtCreator (empty QtQuick project template).
Using qmake works fine for both Windows and Android, so the toolchains
should all be fine so far. But when I make the same empty project as
CMake project I get errors for Android. For Windows it works fine so far.

At first CMake didn't find Ninja for Android (but did find it for
Windows). So I added the it's location to PATH.

Now it could find Ninja, but I got

           The C++ compiler


"C:/Android/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe"

           is not able to compile a simple test program.

I searched on google, and aside from a lot of posts that didn't help at
all, I found this:


https://stackoverflow.com/questions/53633705/cmake-the-c-compiler-is-not-able-to-compile-a-simple-test-program

suggesting it's caused by CMake trying to run an Android application on
Windows, and to add

           set (CMAKE_C_COMPILER_WORKS 1)
           set (CMAKE_CXX_COMPILER_WORKS 1)

before project() to omit the test. And it now changed the error to

           No known features for CXX compiler

           "Clang"

           version 8.0.2.

Again, I googled. But all I could find was related to old bugs or other
IDE's/OS's.

So I hope to get some help here now.

Best regards

Thorsten
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake