Handling the compiler and loader flags using qmake [SOLVED]
-
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.
-
Hi,
Have a look at the qmake Project file manual page, it shows how to use pkg-config with Qt's pro files
-
Hi,
I have solved it like this :
@QMAKE_CXXFLAGS =
pkg-config libgvc --cflags
-Wall -g -O2
QMAKE_LFLAGS =pkg-config libgvc --libs
@thnks :)
-
You should really use the PKGCONFIG variable, it will avoid you to modify these flags by hands
-
Hi :)
I used PKGCONFIG like this:
@
CONFIG +=link_pkgconfig
PKGCONFIG = libgvc
PKGCONFIG += libgvcQMAKE_CXXFLAGS = -Wall -g -O2
@But i didn't understand correctly the advantage of PKGCONFIG!
-
You avoid to have to set both QMAKE_CXXFLAGS and QMAKE_LFLAGS for each library you add through it
-
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.
-
What do you mean ?
-
I mean some info about PKGCONFIG.
-
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)