[CMake] Cross-Compiling with CMake and QtCreator
Thorsten Hofer-Schmitz
thorsten.schmitz.bn.90 at gmail.com
Thu Jun 13 13:35:48 EDT 2019
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
More information about the CMake
mailing list