title: build cmake ExternalProject with gradle
body: <p>I am trying to use an existing native library as part of an android project. I followed instructions about adding C and C++ Code to a project for android studio. I got to the point where I have a functioning CMakeLists.txt file (tested independently) and I've instructed gradle to use it to compile the native code.</p>
  
  <p>The library I'm using uses make so I use ExternalProject_Add to instruct cmake how to compile it. Here is the relevant code:</p>
  
  <pre><code>ExternalProject_Add(foo
      SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../libfoo
      CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/../libfoo/configure
          --host=arm-linux-androideabi
      BUILD_COMMAND ${MAKE}
      INSTALL_COMMAND true)
  </code></pre>
  
  <p>This is the relevant part of the build.gradle for the module:</p>
  
  <pre><code>externalNativeBuild {
      cmake {
          path '../cpp/CMakeLists.txt'
      }
  }
  </code></pre>
  
  <p>When I run <code>./gradlew assembleDebug</code>, the external project is not compiled. After adding an executable (named <code>bar</code>) that depends on <code>foo</code> in cmake, the configure step runs but the build step doesn't. I modified the code of the library so that compilation would fail, but gradle returns success anyway).</p>
  
  <p>Here are the last lines of the output of <code>./gradlew assembleDebug</code> after these changes.</p>
  
  <pre><code>configure: creating ./config.status
  config.status: creating Makefile
  config.status: executing depfiles commands
  [6/10] Performing build step for 'foo'
  [7/10] Performing install step for 'foo'
  [8/10] Completed 'foo'
  [9/10] Building C object CMakeFiles/bar.dir/bar.c.o
  [10/10] Linking C executable bar
  
  BUILD SUCCESSFUL in 18s
  </code></pre>
  
  <p>Any ideas what is happening? What am I doing wrong?</p>
  
  <p>I'm using gradle 4.1 and cmake 3.6.</p>