title: How write content to file in cmake DOWNLOAD_COMMAND?
body: <p>I tried to download only part of repository as it is written here: <a href="https://stackoverflow.com/a/28039894/7042963">https://stackoverflow.com/a/28039894/7042963</a>, but I wanna do this in <code>CMakeLists.txt</code> by using <code>ExternalProject_Add</code> <code>DOWNLOAD_COMMAND</code>.</p>
  
  <p>However, there are some problems. I cannot write content to file sparse-checkout. File exists, but it is empty. This is my CMakeLists.txt file:</p>
  
  <pre><code>include(ExternalProject)
  
  message("CMAKE_CURRENT_BINARY_DIR is set to ${CMAKE_CURRENT_BINARY_DIR}")
  
  ExternalProject_Add(glm
    DOWNLOAD_COMMAND git init
      COMMAND git remote add origin https://github.com/g-truc/glm
      COMMAND git config core.sparsecheckout true
      COMMAND touch .git/info/sparse-checkout
      COMMAND pwd
      COMMAND echo "glm/*" &gt;&gt; .git/info/sparse-checkout
      COMMAND git pull --depth=1 origin master
    PREFIX "${CMAKE_CURRENT_BINARY_DIR}"
    # Disable configure, build and install steps
    CONFIGURE_COMMAND ""
    BUILD_COMMAND ""
    INSTALL_COMMAND ""
    LOG_DOWNLOAD ON
  )
  
  # Specify include dir
  set(GLM_INCLUDE_DIRS ${PREFIX}/src PARENT_SCOPE)
  </code></pre>
  
  <p>Log from this commands execution:</p>
  
  <pre><code>Initialized empty Git repository in /path/to/project/build/modules/glm/src/.git/
  /path/to/project/build/modules/glm/src
  glm/* &gt;&gt; .git/info/sparse-checkout
  </code></pre>
  
  <p>When I look at log, I think that echo simply print next part of this command to output and this is problem.</p>
  
  <p>I tried also replace echo command with this : </p>
  
  <p><code>COMMAND FILE(WRITE .git/info/sparse-checkout "glm/*")</code></p>
  
  <p>And it is error log from this: </p>
  
  <pre><code>CMake Error at glm-stamp/glm-download--impl.cmake:59 (message):
    Command failed (No such file or directory):
  
     'FILE' '(' 'WRITE' '.git/info/sparse-checkout' 'glm/*' ')'
  </code></pre>
  
  <p>Do you know what is the reason of this problem?</p>