summaryrefslogtreecommitdiffstats
path: root/mkspecs
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@qt.io>2017-12-01 19:36:15 +0100
committerOswald Buddenhagen <oswald.buddenhagen@qt.io>2018-06-15 17:55:49 +0000
commita85fe46753bce90483ac81f4d48928fd5bd6eab2 (patch)
tree905a56aa73e0528490050ed923e79d5e6c57f5fd /mkspecs
parent384e72bdb3dcadfe50c6dfa9f475b96180dbf1cf (diff)
configure: make splitting of CFLAGS specific to the pkgConfig source
as evidenced by things actually still working despite qmake_use.prf not processing *_CFLAGS, this is not relevant for any makeSpec sources any more, and was never relevant for other non-pkgConfig sources to start with. localizing the code cleans things up. as a side effect, configure won't emit a notice for dropped flags any more, but will only log them to config.log. i think that makes sense, as for the average user that would be only noise anyway. Change-Id: Iaffde6474b786f5cbcbeac881850792563b74495 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'mkspecs')
-rw-r--r--mkspecs/features/qt_configure.prf62
1 files changed, 34 insertions, 28 deletions
diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf
index 318e585220..8c891c654b 100644
--- a/mkspecs/features/qt_configure.prf
+++ b/mkspecs/features/qt_configure.prf
@@ -604,12 +604,39 @@ defineTest(qtConfLibrary_pkgConfig) {
qtRunLoggedCommand("$$pkg_config --modversion $$args", version)|return(false)
qtRunLoggedCommand("$$pkg_config --libs-only-L $$args", libpaths)|return(false)
qtRunLoggedCommand("$$pkg_config --libs-only-l $$args", libs)|return(false)
- qtRunLoggedCommand("$$pkg_config --cflags $$args", $${1}.cflags)|return(false)
version ~= s/[^0-9.].*$//
$${1}.version = $$first(version)
export($${1}.version)
eval($${1}.libs = $$libpaths $$libs)
export($${1}.libs)
+
+ qtRunLoggedCommand("$$pkg_config --cflags $$args", $${1}.cflags)|return(false)
+ # Split CFLAGS into stuff that goes into DEFINES, INCLUDEPATH, and other stuff.
+ # The compound variable is still set in case something wants to use it outside
+ # regular library exports.
+ defines =
+ includes =
+ ignored =
+ eval(cflags = $$eval($${1}.cflags))
+ 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 include other flags
+ # we really don't need and shouldn't add.
+ ignored += $$i
+ }
+ }
+ !isEmpty(ignored): \
+ qtLog("Note: Dropped compiler flags '$$ignored'.")
+ $${1}.defines = $$defines
+ export($${1}.defines)
+ $${1}.includedir = $$includes
+ export($${1}.includedir)
return(true)
}
@@ -638,9 +665,9 @@ defineReplace(qtConfLibraryArgs) {
includedir = $$eval($${1}.includedir)
!isEmpty(includedir): \
qmake_args += "QMAKE_INCDIR_$${NAME} = $$val_escape(includedir)"
- cflags = $$eval($${1}.cflags)
- !isEmpty(cflags): \
- qmake_args += "QMAKE_CFLAGS += $$cflags" "QMAKE_CXXFLAGS += $$cflags"
+ defines = $$eval($${1}.defines)
+ !isEmpty(defines): \
+ qmake_args += "QMAKE_DEFINES_$${NAME} = $$val_escape(defines)"
return($$qmake_args)
}
@@ -671,38 +698,17 @@ defineTest(qtConfExportLibrary) {
!$$qtConfEvaluate($$eval($${spfx}.export)): return()
output = privatePro
-
- libs = $$eval($${spfx}.libs)
- includes = $$eval($${spfx}.includedir)
- eval(cflags = $$eval($${spfx}.cflags))
-
- # 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 '$$name'.")
-
NAME = $$upper($$name)
# LIBS is emitted even if empty, as this allows the library to be "seen".
+ libs = $$eval($${spfx}.libs)
qtConfOutputVar(assign, $$output, QMAKE_LIBS_$$NAME, $$libs)
for (b, $${spfx}.builds._KEYS_) {
blibs = $$eval($${spfx}.builds.$${b})
qtConfOutputVar(assign, $$output, QMAKE_LIBS_$${NAME}_$$upper($$b), $$blibs)
}
+ defines = $$eval($${spfx}.defines)
!isEmpty(defines): qtConfOutputVar(assign, $$output, QMAKE_DEFINES_$$NAME, $$defines)
+ includes = $$eval($${spfx}.includedir)
!isEmpty(includes): qtConfOutputVar(assign, $$output, QMAKE_INCDIR_$$NAME, $$includes)
!isEmpty($${currentConfig}.module): \
qtConfExtendVar($$output, "QT.$${currentModule}_private.libraries", $$name)