title: How do I setup TagLib 1.11.1 as a static library for my Qt Creator project on OS X?
body: <p>I am working on a C++ project in Qt Creator (on OS X), and I want to use TagLib. After much research online, I'm struggling to figure out how to get to a point where I can use the TagLib library in my project.</p>
  
  <p>So far I have:</p>
  
  <ul>
  <li>Downloaded <code>taglib-1.11.1.tar</code> and unarchived the contents.</li>
  <li>Downloaded CMake and used the GUI to <em>configure</em> and <em>generate</em> these files. (I used the CodeBlocks - Unix options for this, as from what I have found this has been suggested)</li>
  <li>From here I have tried: <strong>a)</strong> Adding the generated files as an external library to my Qt Creator Project. However, this seems to just add ~ 3 lines to my current .pro file referencing the path of the TagLib files. <strong>b)</strong> Creating a new project specifically for this library... <strong>c)</strong> smashing my head against the wall trying to get this to work.</li>
  </ul>
  
  <p>Any help with this would be much appreciated, thanks.</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>When I add the external library, the following is added to my .pro file:</p>
  
  <pre><code>win32:CONFIG(release, debug|release): LIBS += -     L$$PWD/../../../Libraries/taglib-1.11.1/taglib/release/ -ltag
  else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../Libraries/taglib-1.11.1/taglib/debug/ -ltag
  else:mac: LIBS += -F$$PWD/../../../Libraries/taglib-1.11.1/taglib/ -framework tag
  else:unix: LIBS += -L$$PWD/../../../Libraries/taglib-1.11.1/taglib/ -ltag
  
  INCLUDEPATH += $$PWD/../../../Libraries/taglib-1.11.1/taglib
  DEPENDPATH += $$PWD/../../../Libraries/taglib-1.11.1/taglib
  </code></pre>
  
  <p>I then run qmake, and the project builds &amp; runs fine. However, if I attempt to do something like <code>#include &lt;tag.h&gt;</code>, I get an error. For this example, it says <code>'tstring.h' file not found #include "tstring.h"</code>. Then, when I delete the error line, it gives a different error when I run it <code>framework not found tag</code> <code>linker command failed with exit code 1 (use -v to see invocation)</code>.</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>code in .pro changed to:</p>
  
  <pre><code>#win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../Libraries/taglib-1.11.1/taglib/release/ -ltag
  #else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../Libraries/taglib-1.11.1/taglib/debug/ -ltag
  LIBS += -F$$PWD/../../../Libraries/taglib-1.11.1/taglib/ -ltag
  #else:unix: LIBS += -L$$PWD/../../../Libraries/taglib-1.11.1/taglib/ -ltag
  
  INCLUDEPATH += $$PWD/../../../Libraries/taglib-1.11.1/taglib
  DEPENDPATH += $$PWD/../../../Libraries/taglib-1.11.1/taglib
  </code></pre>
  
  <p>Now I get the error <code>library not found for -ltag</code>.</p>
  
  <p>Here is an image of the files under <code>../Libraries/taglib-1.11.1</code> and the options I used in CMake <a href="https://imgur.com/a/Ult33" rel="nofollow noreferrer">link</a>.</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>I installed in it using the following:</p>
  
  <pre><code>  cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release
    make
    sudo make install
  </code></pre>
  
  <p>Now the directory of files in the library looks like the <a href="https://imgur.com/a/tnI27" rel="nofollow noreferrer">following</a>. Then I re-added the external directory in Qt. So now my .pro file contains:</p>
  
  <pre><code>LIBS += -L$$PWD/../../../Libraries/taglib-1.11.1/taglib/ -ltag
  
  INCLUDEPATH += $$PWD/../../../Libraries/taglib-1.11.1/taglib
  DEPENDPATH += $$PWD/../../../Libraries/taglib-1.11.1/taglib
  
  PRE_TARGETDEPS += $$PWD/../../../Libraries/taglib-1.11.1/taglib/libtag.a
  </code></pre>
  
  <p>Now it runs fine, unless I try to do something like <code>#include &lt;tag.h&gt;</code> and it gives the error <code>'tstring.h' file not found</code>.</p>