Include external library in Qt project indipendently of path

Viewed 82

I am developing a C++ app with Qt that depends on the GNU Scientific Library (GSL).

So far, I have linked GSL in the .pro file using LIBS += /path/to/my/GSL/location -l<name_of_the_library> and it works, but it depends on where I installed GSL. I'd like the .pro file not to depend on the user-specific GSL path, and possibly include the precompiled libraries (for different OSes) in the project folder.

Is this possible?

1 Answers

In this case it works on all platforms. You have to separate the directory from the library name

LIBS += -L/path/to -lpsapi

In this case You store your lib files in the project directory.

LIBS += -L"$$_PRO_FILE_PWD_/3rdparty/libs/" -lpsapi

look at this for more: https://doc.qt.io/qtcreator/creator-project-qmake-libraries.html

Related