Split CFLAGS from pkg-config properly

Add support for DEFINES and INCLUDEPATH to link_pkgconfig so moc uses
the cflags properly.

Task-number: QTBUG-19922
Merge-request: 2674
Reviewed-by: ossi

(cherry picked from commit 2a1e82452a192c88bcf0250f5976492f6dc3b65f)

Change-Id: I0cf543c26780ab9d6d39450435e2c1947fee3954
Reviewed-on: http://codereview.qt-project.org/4592
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
This commit is contained in:
Jan Arne Petersen 2011-09-07 21:38:21 +02:00 committed by Qt by Nokia
parent 6daaa1bcad
commit 6f87278e0a

View File

@ -5,8 +5,21 @@ for(PKGCONFIG_LIB, $$list($$unique(PKGCONFIG))) {
# don't proceed if the .pro asks for a package we don't have!
!packagesExist($$PKGCONFIG_LIB):error("Package $$PKGCONFIG_LIB not found")
QMAKE_CXXFLAGS += $$system($$PKG_CONFIG --cflags $$PKGCONFIG_LIB)
QMAKE_CFLAGS += $$system($$PKG_CONFIG --cflags $$PKGCONFIG_LIB)
PKGCONFIG_CFLAGS = $$system($$PKG_CONFIG --cflags $$PKGCONFIG_LIB)
PKGCONFIG_INCLUDEPATH = $$find(PKGCONFIG_CFLAGS, ^-I.*)
PKGCONFIG_INCLUDEPATH ~= s/^-I(.*)/\\1/g
PKGCONFIG_DEFINES = $$find(PKGCONFIG_CFLAGS, ^-D.*)
PKGCONFIG_DEFINES ~= s/^-D(.*)/\\1/g
PKGCONFIG_CFLAGS ~= s/^-[ID].*//g
INCLUDEPATH *= $$PKGCONFIG_INCLUDEPATH
DEFINES *= $$PKGCONFIG_DEFINES
QMAKE_CXXFLAGS += $$PKGCONFIG_CFLAGS
QMAKE_CFLAGS += $$PKGCONFIG_CFLAGS
LIBS += $$system($$PKG_CONFIG --libs $$PKGCONFIG_LIB)
}