configure a Qt5 5.7 application for Android with CMake
<p>I've successfully configured and built some Qt5 applications for <strong>Android</strong> using <strong>CMake</strong> and <strong><a href="https://github.com/LaurentGomila/qt-android-cmake">this</a></strong> CMake utility.</p>

<p>Everything worked fine until I switched from <strong>Qt5.6</strong> to <strong>Qt5.7</strong>. When I try to configure I get an CMake error which doesn't help me much:</p>

<pre><code>-- Configuring done
CMake Error in CMakeLists.txt:
  No known features for CXX compiler

  "GNU"

  version 4.9.

-- Generating done
-- Build files have been written to: /path/to/build-dir
</code></pre>

<p>I run CMake like this:</p>

<pre><code>ANDROID_SDK=/path/to/android-sdk-linux \
ANDROID_NDK=/path/to/android-ndk-r12 \
QT_ANDROID_ROOT=/path/to/Qt-5.7.0-android \
JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk \
ANT=/usr/bin/ant \
cmake /path/to/CMakeLists.txt \
      -DCMAKE_PREFIX_PATH=$QT_ANDROID_ROOT \
      -DCMAKE_TOOLCHAIN_FILE=/path/to/android.toolchain.cmake
</code></pre>

<p>I can reproduce this behavior with a minimal C++ program:</p>

<pre><code>#include &lt;iostream&gt;
int main() { std::cout &lt;&lt; "hi" &lt;&lt; std::endl; }
</code></pre>

<p>and a minimal <code>CMakeLists.txt</code>:</p>

<pre><code>cmake_minimum_required(VERSION 3.1)
find_package(Qt5Core)
add_executable(foo main.cpp)
target_link_libraries(foo Qt5::Core)
</code></pre>

<p>The line that introduces this error is <code>target_link_libraries(foo Qt5::Core)</code> - without it the program configures and compiles fine.</p>

<p>Here are some things I tried:</p>

<ul>
<li><p>use different NDK API levels by setting <code>ANDROID_NATIVE_API_LEVEL</code> to <code>android-8</code>, <code>9</code>, <code>16</code>, <code>18</code> and some other values that worked somwhere else (building Qt5.7 automatically uses <code>android-16</code>)</p></li>
<li><p>use different <code>NDK</code> releases (10e worked for me with Qt5.6, current is 12)</p></li>
<li><p>tried prebuilt Qt5.7 rather than home-grown from GitHub</p></li>
</ul>

<p>Until now I just combined different versions of SDK/NDK/Qt/NDK_API_LEVEL but honestly I just don't know what I'm doing..</p>

<p>You could help me by:</p>

<ul>
<li>telling me what I've done wrong (best!)</li>
<li>elaborate on that CMake error to give me a hint</li>
<li>provide me with a working CMake/Android/Qt5.7 example which I can use myself to find the problem</li>
</ul>