0

I'm new to the world of cmake and linking to libaries. Now for a project I need to include a third party library in the current application. However I'm having problems linking to the library.

Here is what I have:

  • The library is build in the location D:/qwt-6.1.2, which contains:

    • the folder /src with the header and source files
    • the folder /lib which contains (qwt.dll, qwt.ext, qwt.lib, qwtd.dll, qwtd.ext, qwtd.ilk, qwtd.lib and qwtd.pdb.
  • I have tried to add the following to the cmake file:

    add_executable(Demo main.cpp mainwindow.cpp mainwindow.h )   
    include_directories(D:/qwt-6.1.2/src)   
    link_directories(D:/qwt-6.1.2/lib)
    target_link_libraries(Demo qwt)
    

The including goes fine since the intellisense of visual studio can the includes that I do, however when I build I get the error:

Error   1   error LNK1104: cannot open file 'qwt.lib'

Does anybody have an idea what I'm doing wrong? I don't care at the moment if it is statically or dynamically linked.

ComicSansMS
  • 51,484
  • 14
  • 155
  • 166
Frank
  • 2,446
  • 7
  • 33
  • 67
  • 3
    See if [this](http://stackoverflow.com/questions/31438916/cmake-cannot-find-library-using-link-directories/31471772#31471772) answers your question. If it works, I would close this as a duplicate. – ComicSansMS Jan 20 '16 at 12:34
  • It is indeed fixed by this answer you mention – Frank Jan 20 '16 at 18:41

0 Answers0