title: Implementing Qt project through CMake
body: <p>I am trying to  build and run very simple and basic example of Qt through Cmake, removing the .pro file.
  The following is the code for Qt project(the directory structure for the Qt project automatically generated is</p>
  
  <pre><code>Cmake (my project name)
  ├── headers
  │   └── mainwindow.h
  ├── sources
  │   ├── main.cpp
  │   └── mainwindow.cpp
  └── forms
      └── mainwindow.ui
  </code></pre>
  
  <p>mainwindow.h </p>
  
  <pre><code>#ifndef MAINWINDOW_H
  #define MAINWINDOW_H
  
  #include &lt;QMainWindow&gt;
  
  namespace Ui {
  class MainWindow;
  }
  
  class MainWindow : public QMainWindow
  {
      Q_OBJECT
  
  public:
      explicit MainWindow(QWidget *parent = 0);
      ~MainWindow();
  
  private:
      Ui::MainWindow *ui;
  };
  
  #endif // MAINWINDOW_H
  </code></pre>
  
  <p>mainwindow.cpp</p>
  
  <pre><code>#include "mainwindow.h"
  #include "ui_mainwindow.h"
  
  MainWindow::MainWindow(QWidget *parent) :
      QMainWindow(parent),
      ui(new Ui::MainWindow)
  {
      ui-&gt;setupUi(this);
  }
  
  MainWindow::~MainWindow()
  {
      delete ui;
  }
  </code></pre>
  
  <p>main.cpp</p>
  
  <pre><code>#include "mainwindow.h"
  #include &lt;QApplication&gt;
  
  int main(int argc, char *argv[])
  {
      QApplication a(argc, argv);
      MainWindow w;
      w.show();
  
      return a.exec();
  }
  </code></pre>
  
  <p>This is my CmakeLists.txt</p>
  
  <pre><code>project(Cmake)
  
  find_package(Qt5Widgets)
  
  set(CMAKE_AUTOMOC ON)
  set(CMAKE_INCLUDE_CURRENT_DIR ON)
  
  QT5_WRAP_CPP(Cmake_hdr_moc mainwindow.h)
  QT5_WRAP_UI(Cmake_form_hdr mainwindow.ui)
  
  add_library(mainwindow ${Cmake_hdr_moc} ${Cmake_form_hdr})
  qt5_use_modules(mainwindow Widgets)
  
  add_executable(Cmake main.cpp mainwindow)
  qt5_use_modules(Cmake Core Gui Widgets)
  </code></pre>
  
  <p>mainwindow.ui</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;ui version="4.0"&gt;
   &lt;class&gt;MainWindow&lt;/class&gt;
   &lt;widget class="QMainWindow" name="MainWindow"&gt;
    &lt;property name="geometry"&gt;
     &lt;rect&gt;
      &lt;x&gt;0&lt;/x&gt;
      &lt;y&gt;0&lt;/y&gt;
      &lt;width&gt;400&lt;/width&gt;
      &lt;height&gt;300&lt;/height&gt;
     &lt;/rect&gt;
    &lt;/property&gt;
    &lt;property name="windowTitle"&gt;
     &lt;string&gt;MainWindow&lt;/string&gt;
    &lt;/property&gt;
    &lt;widget class="QWidget" name="centralWidget"/&gt;
    &lt;widget class="QMenuBar" name="menuBar"&gt;
     &lt;property name="geometry"&gt;
      &lt;rect&gt;
       &lt;x&gt;0&lt;/x&gt;
       &lt;y&gt;0&lt;/y&gt;
       &lt;width&gt;400&lt;/width&gt;
       &lt;height&gt;29&lt;/height&gt;
      &lt;/rect&gt;
     &lt;/property&gt;
    &lt;/widget&gt;
    &lt;widget class="QToolBar" name="mainToolBar"&gt;
     &lt;attribute name="toolBarArea"&gt;
      &lt;enum&gt;TopToolBarArea&lt;/enum&gt;
     &lt;/attribute&gt;
     &lt;attribute name="toolBarBreak"&gt;
      &lt;bool&gt;false&lt;/bool&gt;
     &lt;/attribute&gt;
    &lt;/widget&gt;
    &lt;widget class="QStatusBar" name="statusBar"/&gt;
   &lt;/widget&gt;
   &lt;layoutdefault spacing="6" margin="11"/&gt;
   &lt;resources/&gt;
   &lt;connections/&gt;
  &lt;/ui&gt;
  </code></pre>
  
  <p>When I build the project and run Cmake, it points to file mainwindow.h indicating 'ui_mainwindow.h' no such file or directory.</p>