title: Replacing RPATH when Deploying Qt Shared Libraries
body: <h2>Setup</h2>
  <ul>
  <li><p>I have a local installation of Qt located in my home directory: <code>/home/user/Qt/...</code> (from now on, <em>devdir</em>).</p>
  </li>
  <li><p>The Qt application that I'm trying to package installs the relevant Qt shared libraries to <code>/usr/lib/myapplication</code> (from now on, <em>installdir</em>).</p>
  </li>
  <li><p>My packaging process is currently set up like this:</p>
  <p><code>qmake</code> &gt; <code>dh_make -s --createorig</code> &gt; <code>debuild</code></p>
  </li>
  </ul>
  <h2>Problem</h2>
  <p>I am trying to set <code>RPATH</code> in <em>myapplication.pro</em> to only link to libraries in <em>installdir</em>, but it is currently linking to both <em>installdir</em> and <em>devdir</em>.</p>
  <p>I think it has to do with <code>qmake</code> creating dependencies to the installation libraries automatically. To try to stop it, I have run the build process with <code>qmake -nodepend</code>, but that hasn't stopped the link to <em>devdir</em> from happening.</p>
  <p>How do I force <code>qmake</code> to link only to libraries in <em>installdir</em>?</p>
  <h2>Code</h2>
  <p>In <em>myapplication.pro</em>:</p>
  <pre><code>QMAKE_LFLAGS = -Wl,-rpath,/usr/lib/myapplication
  </code></pre>
  <p>The resulting link flags in the Makefile are:</p>
  <pre><code>LFLAGS = -Wl,-rpath,/usr/lib/myapplication -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-rpath,/home/user/Qt/5.3/gcc_64 -Wl,-rpath,/home/user/Qt/5.3/gcc_64/lib
  </code></pre>