Make sure flags from library detections go to the right places
Split them and add -I flags to INCLUDEPATH and -D flags to DEFINES. Anything else gets reported as a problem and dropped. This has the benefit that qmake will automatically use -isystem for those paths if they lie in a system directory. As a consequence of that, we won't get any warnings in headers located there. There are multiple cases of glib, gtk, etc. headers producing warnings (such as enums ending in comma). This does not fix warnings produced by use of macros declared in system headers, though... Done-with: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Change-Id: I4b844cb518dbae5ea499811221f9015af985110a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
This commit is contained in:
parent
33d748bb88
commit
310bf3f57c
@ -36,7 +36,6 @@ QMAKE_LIBS_OPENGL_ES2 = -lGLESv2
|
||||
QMAKE_LIBS_OPENVG = -lOpenVG
|
||||
QMAKE_LIBS_THREAD = -lpthread
|
||||
|
||||
QMAKE_CFLAGS_WAYLAND =
|
||||
QMAKE_INCDIR_WAYLAND =
|
||||
QMAKE_LIBS_WAYLAND_CLIENT = -lwayland-client
|
||||
QMAKE_LIBS_WAYLAND_SERVER = -lwayland-server
|
||||
|
@ -10,16 +10,17 @@ for(ever) {
|
||||
else: \
|
||||
libs = $$eval(QMAKE_LIBS_$${nu}_RELEASE)
|
||||
libs += $$eval(QMAKE_LIBS_$$nu)
|
||||
cflags = $$eval(QMAKE_CFLAGS_$${nu})
|
||||
defines = $$eval(QMAKE_DEFINES_$${nu})
|
||||
includes = $$eval(QMAKE_INCDIR_$${nu})
|
||||
|
||||
isEmpty(libs):isEmpty(cflags): \
|
||||
isEmpty(libs):isEmpty(defines):isEmpty(includes): \
|
||||
error("Library '$$name' is not defined.")
|
||||
|
||||
!contains(use, nolink): \
|
||||
LIBS$${suffix} += $$libs
|
||||
!contains(use, linkonly) {
|
||||
QMAKE_CFLAGS += $$cflags
|
||||
QMAKE_CXXFLAGS += $$cflags
|
||||
DEFINES += $$defines
|
||||
INCLUDEPATH += $$includes
|
||||
}
|
||||
}
|
||||
!isEmpty(suffix): break()
|
||||
|
@ -475,8 +475,6 @@ defineTest(qtConfLibrary_inline) {
|
||||
!isEmpty(prefix) {
|
||||
$${1}.includedir = $$prefix/include
|
||||
export($${1}.includedir)
|
||||
$${1}.cflags = -I$$prefix/include
|
||||
export($${1}.cflags)
|
||||
$${1}.libs = "-L$$prefix/lib $$eval($${1}.libs)"
|
||||
export($${1}.libs)
|
||||
}
|
||||
@ -493,8 +491,6 @@ defineTest(qtConfLibrary_makeSpec) {
|
||||
|
||||
$${1}.includedir = "$$val_escape(QMAKE_INCDIR_$$spec)"
|
||||
export($${1}.includedir)
|
||||
$${1}.cflags = "$$val_escape(QMAKE_CFLAGS_$$spec)"
|
||||
export($${1}.cflags)
|
||||
libs =
|
||||
for (l, QMAKE_LIBDIR_$$spec): \
|
||||
libs += -L$$l
|
||||
@ -522,15 +518,8 @@ defineTest(qtConfLibrary_pkgConfig) {
|
||||
qtRunLoggedCommand("$$pkg_config --modversion $$args", version)|return(false)
|
||||
qtRunLoggedCommand("$$pkg_config --libs-only-L --libs-only-l $$args", $${1}.libs)|return(false)
|
||||
qtRunLoggedCommand("$$pkg_config --cflags $$args", $${1}.cflags)|return(false)
|
||||
qtRunLoggedCommand("$$pkg_config --cflags-only-I $$args", includes)|return(false)
|
||||
eval(includes = $$includes)
|
||||
includes ~= s/^-I//g
|
||||
$${1}.includedir = "$$val_escape(includes)"
|
||||
version ~= s/[^0-9.].*$//
|
||||
$${1}.version = $$first(version)
|
||||
export($${1}.libs)
|
||||
export($${1}.cflags)
|
||||
export($${1}.includedir)
|
||||
export($${1}.version)
|
||||
return(true)
|
||||
}
|
||||
@ -562,6 +551,9 @@ defineReplace(qtConfLibraryArgs) {
|
||||
includedir = $$eval($${1}.includedir)
|
||||
!isEmpty(includedir): \
|
||||
qmake_args += $$system_quote(INCLUDEPATH *= $$includedir)
|
||||
cflags = $$eval($${1}.cflags)
|
||||
!isEmpty(cflags): \
|
||||
qmake_args += $$system_quote(QMAKE_CFLAGS += $$cflags) $$system_quote(QMAKE_CXXFLAGS += $$cflags)
|
||||
return($$qmake_args)
|
||||
}
|
||||
|
||||
@ -588,12 +580,31 @@ defineTest(qtConfExportLibrary) {
|
||||
eval(includes = $$eval($${1}.includedir))
|
||||
version = $$eval($${1}.version)
|
||||
|
||||
# Split $$cflags into stuff that goes into DEFINES, INCLUDEPATH, and other stuff.
|
||||
defines =
|
||||
ignored =
|
||||
for (i, cflags) {
|
||||
contains(i, "-I.*") {
|
||||
i ~= s/^-I//
|
||||
includes += $$i
|
||||
} else: contains(i, "-D.*") {
|
||||
i ~= s/^-D//
|
||||
defines += $$i
|
||||
} else {
|
||||
# Sometimes, pkg-config files or *-config scripts include other flags
|
||||
# we really don't need and shouldn't add (pg_config is really bad).
|
||||
ignored += $$i
|
||||
}
|
||||
}
|
||||
!isEmpty(ignored): \
|
||||
qtConfAddNote("Dropped compiler flags '$$ignored' when detecting library '$$2'.")
|
||||
|
||||
NAME = $$upper($$2)
|
||||
!isEmpty(libs): qtConfOutputVar(assign, $$output, QMAKE_LIBS_$$NAME, $$libs)
|
||||
for (b, $${1}.builds._KEYS_): \
|
||||
qtConfOutputVar(assign, $$output, QMAKE_LIBS_$${NAME}_$$upper($$b), \
|
||||
$$eval($${1}.builds.$${b}))
|
||||
!isEmpty(cflags): qtConfOutputVar(assign, $$output, QMAKE_CFLAGS_$$NAME, $$cflags)
|
||||
!isEmpty(defines): qtConfOutputVar(assign, $$output, QMAKE_DEFINES_$$NAME, $$defines)
|
||||
!isEmpty(includes): qtConfOutputVar(assign, $$output, QMAKE_INCDIR_$$NAME, $$includes)
|
||||
!isEmpty(version) {
|
||||
qtConfOutputVar(assign, $$output, QMAKE_$${NAME}_VERSION, $$version)
|
||||
|
@ -22,11 +22,8 @@ defineTest(qtConfLibrary_psqlConfig) {
|
||||
$${1}.libs = "$$val_escape(libs)"
|
||||
includedir -= $$QMAKE_DEFAULT_INCDIRS
|
||||
$${1}.includedir = "$$val_escape(includedir)"
|
||||
!isEmpty(includedir): \
|
||||
$${1}.cflags = "-I$$val_escape(includedir)"
|
||||
export($${1}.libs)
|
||||
export($${1}.includedir)
|
||||
export($${1}.cflags)
|
||||
return(true)
|
||||
}
|
||||
return(false)
|
||||
@ -65,11 +62,8 @@ defineTest(qtConfLibrary_mysqlConfig) {
|
||||
includedir ~= s/^-I//g
|
||||
includedir -= $$QMAKE_DEFAULT_INCDIRS
|
||||
$${1}.includedir = "$$val_escape(includedir)"
|
||||
!isEmpty(includedir): \
|
||||
$${1}.cflags = "-I$$val_escape(includedir)"
|
||||
export($${1}.libs)
|
||||
export($${1}.includedir)
|
||||
export($${1}.cflags)
|
||||
return(true)
|
||||
}
|
||||
return(false)
|
||||
|
Loading…
Reference in New Issue
Block a user