title: Compiling Chipmunk2D for Android using CMake
body: <p>I want to use <a href="https://github.com/slembcke/Chipmunk2D" rel="nofollow">Chipmunk2D</a> on Android.</p>
  
  <p>In the sample <code>Chipmunk2D/android/Android.mk</code> they talk about using CMake to build Chipmunk2d for Android. As per the comment of the commit when this file was added suggests, I use <a href="https://github.com/taka-no-me/android-cmake" rel="nofollow">Android-CMake</a> to build a static library and then link that in my Android project.</p>
  
  <p>I invoke it like this:</p>
  
  <pre><code>cd Chipmunk2D/
  cmake -DCMAKE_TOOLCHAIN_FILE=../android-cmake/android.toolchain.cmake \
        -DANDROID_NDK=~/ndk \
        -DCMAKE_BUILD_TYPE=Release \
        -DANDROID_ABI="armeabi" .
  cmake --build .
  </code></pre>
  
  <p>Where Chipmunk2D is the folder containing the Chipmunk2D project, android-cmake contains Android-CMake, and ~/ndk is a symlink to android-ndk-r10.</p>
  
  <p>It seems that the resulting .a is not compiled for Android, but for my local host because:</p>
  
  <ol>
  <li>After compiling for my host and trying to compile for Android, CMake does nothing, i.e., it considers the targets completed.</li>
  <li>When linking for Android ld complains "no archive symbol table (run ranlib)" and there are errors to undefined references to Chipmunk2D functions.</li>
  </ol>
  
  <p>My current solution is to write an Android.mk similar to this one: <a href="https://gist.github.com/kristianlm/2628615" rel="nofollow">https://gist.github.com/kristianlm/2628615</a> (warning, this is outdated). But then I'm reinventing how to build Chipmunk2D and I might be missing some build configurations from the project authors.</p>
  
  <p>How do you build Chipmunk2D for Android using CMake?</p>