title: Qmake not linking Qt static library
body: <p>I am putting together an example project structure for a desktop application stack including Qt, Googletest, CMake, and C++. The goal here is to have a cross-platform project structure that people can copy from github to insert their code for their C or C++ static library (used by their UI), automated unit testing for their library, and UI (Qt5) code in a well organized sample project. I'll eventually write scripts (or use RPMs) to pull down the dependencies for the project and build the project's static library and link it to the UI, which it also packages into an executable.</p>
  
  <p>I have all parts of the stack working well except Qt. I don't want to use QtCreator because that creates additional dependency complication and increases install size by quite a bit, so I'm compiling everything on command line. On both Windows and Linux (Ubuntu), I have an issue where after I make the release directory or makefile with qmake, the object file or makefile (respectively) does not link Qt to the project. How do I tell qmake to link libraries (including Qt itself) in the makefile or object file it builds?</p>
  
  <p>As additional background, I am using Designer to make .ui files for the project. I turn them into header files using</p>
  
  <pre><code>uic -o ui_mainwindow.h mainwindow.ui
  </code></pre>
  
  <p>Assuming the static library for the actual code part of the project has already been compiled, my build steps for the UI are:</p>
  
  <pre><code>qmake -project
  qmake ui.pro
  nmake release
  </code></pre>
  
  <p>And the output I get is:</p>
  
  <pre><code>cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -O2 -MD -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc -DUNICODE -D_UNICODE -DWIN32 -D_ENABLE_EXTENDED_ALIGNED_STORAGE -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DNDEBUG -I. -I. -IC:\qt5\qtbase\include -IC:\qt5\qtbase\include\QtGui -IC:\qt5\qtbase\include\QtCore -Irelease -IC:\qt5\qtbase\mkspecs\win32-msvc -Forelease\ @C:\Users\User\AppData\Local\Temp\nmA4E2.tmp                                                   mainwindow.cpp                                                                                                                  
  link /NOLOGO /DYNAMICBASE /NXCOMPAT /INCREMENTAL:NO /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /MANIFEST:embed /OUT:release\ui.exe @C:\Users\User\AppData\Local\Temp\nmAACF.tmp                                   
  mainwindow.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall QWidget::QWidget(class QWidget *,class QFlags&lt;enum Qt::WindowType&gt;)" (__imp_??0QWidget@@QAE@PAV0@V?$QFlags@W4WindowType@Qt@@@@@Z) referenced in function "public: void __thiscall Ui_MainWindow::setupUi(class QMainWindow *)" (?setupUi@Ui_MainWindow@@QAEXPAVQMainWindow@@@Z)                                                                                                            
  mainwindow.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall QWidget::~QWidget(void)" (__imp_??1QWidget@@UAE@XZ) referenced in function "public: virtual void * __thiscall QWidget::`scalar deleting destructor'(unsigned int)" (??_GQWidget@@UAEPAXI@Z) 
  </code></pre>
  
  <p>followed by many more errors of the same LNK2019 type, which indicates to me that Qt is not properly linked. This build is on Windows 10, but very similar errors occur on Ubuntu 16.04</p>
  
  <p>Just in case this is something wrong in my code and not in the linking, here's my mainwindow.cpp file:</p>
  
  <pre><code>#include &lt;QtWidgets/QMainWindow&gt;
  #include &lt;QtWidgets/QApplication&gt;
  #include "ui_mainwindow.h"
  
  int main(int argc, char *argv[]) {
      QApplication app(argc, argv);
      QMainWindow *window = new QMainWindow;
      Ui::MainWindow ui;
      ui.setupUi(window);
      window-&gt;show();
      return app.exec();
  }
  </code></pre>
  
  <p>The ui_mainwindow.h file is generated by uic from a Qt designer ui file, and it is very long so I will not include it here.</p>
  
  <p>So just to repeat the question for the sake of redundancy, how do I tell qmake to link libraries (including Qt itself) in the makefile or object file it builds?</p>