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. Handling the compiler and loader flags using qmake [SOLVED]

Handling the compiler and loader flags using qmake [SOLVED]

Scheduled Pinned Locked Moved General and Desktop
10 Posts 2 Posters 3.8k Views 1 Watching
  • 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.
  • I Offline
    I Offline
    issam
    wrote on last edited by
    #1

    Hi,

    I have to compile and link a Qt application which uses the GraphViz library. So I have to pass some flags to the compiler (g++) and the loader like this:

    @
    CFLAGS=pkg-config libgvc --cflags -Wall -g -O2
    LDFLAGS=pkg-config libgvc --libs
    @

    How can I pass those flags through the qmake file ?

    thnks in advance.

    http://www.iissam.com/

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Have a look at the qmake Project file manual page, it shows how to use pkg-config with Qt's pro files

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • I Offline
        I Offline
        issam
        wrote on last edited by
        #3

        Hi,

        I have solved it like this :

        @QMAKE_CXXFLAGS =pkg-config libgvc --cflags -Wall -g -O2
        QMAKE_LFLAGS =pkg-config libgvc --libs@

        thnks :)

        http://www.iissam.com/

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          You should really use the PKGCONFIG variable, it will avoid you to modify these flags by hands

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • I Offline
            I Offline
            issam
            wrote on last edited by
            #5

            Hi :)

            I used PKGCONFIG like this:

            @
            CONFIG +=link_pkgconfig
            PKGCONFIG = libgvc
            PKGCONFIG += libgvc

            QMAKE_CXXFLAGS = -Wall -g -O2
            @

            But i didn't understand correctly the advantage of PKGCONFIG!

            http://www.iissam.com/

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              You avoid to have to set both QMAKE_CXXFLAGS and QMAKE_LFLAGS for each library you add through it

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • I Offline
                I Offline
                issam
                wrote on last edited by
                #7

                Yes, you have right :)

                @
                CONFIG +=link_pkgconfig
                PKGCONFIG = libgvc
                PKGCONFIG += libgvc
                @

                Can you write two sentences about the advantages and basic role of the PKGCONFIG. I will be grateful :)

                Thanks in advantage.

                http://www.iissam.com/

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  What do you mean ?

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • I Offline
                    I Offline
                    issam
                    wrote on last edited by
                    #9

                    I mean some info about PKGCONFIG.

                    http://www.iissam.com/

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      PKGCONFIG contains the list of the library that you want to build against/link to and this content will be fed to the pkg-config command to retrieve the include paths and link flags.

                      Note that the libraries you list there must provide a pc file (most do)

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0

                      • Login

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