title: Qt using CMake: ui_mainwindow.h: No such file or directory
body: <p>I use Qt with CMake because CMake integrates with my team's work easier than my own. I have frequently encountered an error along the lines of </p>
  
  <pre><code>ui_*.h: No such file or directory
  </code></pre>
  
  <p>Usually when my project already has a <code>ui_*.h</code> file to start with it will just modify that <code>.h</code> file. I do use the below commands in my CMake file, so it should be wrapping my <code>.ui</code> file with the appropriate <code>ui_*.h</code> file.</p>
  
  <pre><code>qt4_wrap_ui (mainwindow  mainwindow.ui)
  target_linked_library (mainwindow ${QT_LIBRARIES})
  </code></pre>
  
  <p>But sometimes that doesn't work and I have to completely rebuild the entire <code>ui_*.h</code> file. What am I doing wrong?</p>