Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Extend INCLUDEPATH using pkg-config?

Extend INCLUDEPATH using pkg-config?

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 1 Posters 696 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Robert Hairgrove
    wrote on 6 Jul 2020, 08:09 last edited by
    #1

    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 the graphviz-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 the include path to the header gvc.h.

    Is there another way to use pkg-config in qmake to query the right include path?

    1 Reply Last reply
    0
    • R Offline
      R Offline
      Robert Hairgrove
      wrote on 6 Jul 2020, 08:58 last edited by Robert Hairgrove 7 Sept 2020, 06:56
      #2

      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?

      1 Reply Last reply
      0
      • R Offline
        R Offline
        Robert Hairgrove
        wrote on 11 Jul 2020, 12:38 last edited by
        #3

        Here is one solution for OSX which even uses GraphViz libraries:
        https://github.com/nbergont/qgv/blob/master/QGVCore/GraphViz.pri

        which I found after looking at this post on stackoverflow:
        https://stackoverflow.com/questions/16972066/using-pkg-config-with-qt-creator-qmake-on-mac-osx

        The key to this is to install graphviz using homebrew (and also installing pkg-config with homebrew), then in the .pro file it is necessary to add mac: 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 Reply Last reply
        0

        1/3

        6 Jul 2020, 08:09

        • Login

        • Login or register to search.
        1 out of 3
        • First post
          1/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved