title: CMake : detect "Q_OBJECT" in a file and add it to a list of file to treat by MOC
body: <p>Currently, I use a variable <code>MYPROJECT_CURRENT_HEADERS</code> in CMake to list all the headers. As I use Qt, my CMakeLists.txt contains :</p>
  
  <pre><code>QT4_WRAP_CPP(MYPROJECT_CURRENT_MOC ${MYPROJECT_CURRENT_HEADERS})
  </code></pre>
  
  <p>The problem is that all headers are treated by moc, even those that don't have a <code>Q_OBJECT</code> : so it generates many empty file.</p>
  
  <p>Is there a solution to "grep"/detect if the file contains the string <code>Q_OBJECT</code> and if it's the case, add it to <code>MYPROJECT_CURRENT_MOC</code> ?</p>
  
  <p>Thank you</p>