title: CMake: File Globbing in subdirectories
body: <p>I want to add an install directive (i.e.: I want to have <code>make install</code> do the right thing) to google mock and google test frameworks in CMake as I need them to be cross compiled.</p>
  
  <p>Since this is an external library I want to keep changes rather non-inversive.
  Is there a possibility to get CMake File Globbing working to glob a subdirectory without using <code>GLOB_RECURSE</code>?</p>
  
  <p>the problem I encounter with gtest is that include/gtest/interal gets flattened by the function I defined if I glob recursively. Hence files in the directory include/gtest/internal get installed to <code>${prefix}/include/gtest</code> instead <code>${prefix}/include/gtest/internal</code></p>
  
  <p>if possible I'd like to not add <code>CMakeLists.txt</code> files in the include directories.</p>
  
  <pre><code>function(install_header dest_dir)
      foreach(header ${ARGN})
          install(FILES include/${header}
              DESTINATION include/google/${dest_dir}
          )
      endforeach()
  endfunction()
  
  # doesn't work with GLOB
  # but works with GLOB_RECURSE -- however copies more than intended
  file(GLOB headers RELATIVE ${gtest_SOURCE_DIR}/include/ *.h.pump *.h )
  file(GLOB internalheaders RELATIVE ${gtest_SOURCE_DIR}/include/gtest/internal/ *.h.pump *.h )
  if(NOT headers)
  message(FATAL_ERROR "headers not found")
  endif()
  if(NOT internalheaders)
  message(FATAL_ERROR "headers not found")
  endif()
  
  install_header(gtest ${headers})
  install_header(gtest/internal ${internalheaders})
  </code></pre>