title: How do I set up CMake to generate header-only projects?
body: <p>I want to set up header-only C++ (or C) library projects, but can't find a clean way.</p>
  
  <p>After some searches I've found that you can't set up a normal library using <code>add_library</code> to do this because it requires a compilable source file.
  A way to do this would be to use <code>add_custom_target</code> instead, this way: </p>
  
  <pre><code># Get all headers (using search instead of explicit filenames for the example)
  file( GLOB_RECURSE XSD_HEADERS 
      *.hxx
  )
  add_custom_target( libsxsd SOURCES ${XSD_HEADERS} )
  </code></pre>
  
  <p>But that doesn't seem to work completely here as I can't see the sources in the project generated in VS2010. I don't know if it's a bug or if I'm doing it wrong or if there is a preferred way to do this.</p>