Extend INCLUDEPATH using pkg-config?
-
wrote on 6 Jul 2020, 08:09 last edited by
I am linking in GraphViz libraries to my project. I can add the libraries like this:
unix { CONFIG += link_pkgconfig PKGCONFIG += libgvc }
This works OK. However, I am having problems with adding to the INCLUDEPATH variable. If I install GraphViz by building from the sources, the default include directory seems to be
/usr/local/include/graphviz
. However, if I install thegraphviz-dev
package from Ubuntu repositories, it puts it in/usr/include/graphviz
. Therefore, I need to query pkg-config if I want to avoid hard-coding theinclude
path to the headergvc.h
.Is there another way to use
pkg-config
inqmake
to query the right include path? -
wrote on 6 Jul 2020, 08:58 last edited by Robert Hairgrove 7 Sept 2020, 06:56
Strange, after trying this again, it seems that the proper include path is now picked up as well as the libraries.
EDIT:
I might need to do this on Mac OSX as well ... if I install graphviz using MacPorts on OSX, how would I set up the.pro
file to find the headers and libraries similar to the above? -
wrote on 11 Jul 2020, 12:38 last edited by
Here is one solution for OSX which even uses GraphViz libraries:
https://github.com/nbergont/qgv/blob/master/QGVCore/GraphViz.priwhich I found after looking at this post on stackoverflow:
https://stackoverflow.com/questions/16972066/using-pkg-config-with-qt-creator-qmake-on-mac-osxThe key to this is to install
graphviz
usinghomebrew
(and also installingpkg-config
with homebrew), then in the.pro
file it is necessary to addmac: QT_CONFIG -= no-pkg-config
somewhere.Note that there might be other issues such as setting the PATH environment variable to include
/usr/local/bin
if building with Qt Creator on OSX.On Linux Ubuntu, it is sufficient to specify
PKGCONFIG += libgvc
instead of each library individually. This will output:-lgvc -lcgraph -lcdt
I will have to test this on OSX if I ever need to actually build this application for that platform.
1/3