escape literal backslashes in qmake files

Task-number: QTBUG-70765
Change-Id: I56abbf19be88d01b2964980fb741567f28e4f0fa
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Oswald Buddenhagen 2018-10-19 19:01:37 +02:00
parent 2c6ec2c653
commit bccb964b9a
6 changed files with 25 additions and 25 deletions

View File

@ -110,7 +110,7 @@
# Backwards compatibility # Backwards compatibility
for (bundle_data, QMAKE_BUNDLE_DATA) { for (bundle_data, QMAKE_BUNDLE_DATA) {
for (bundle_file, $${bundle_data}.files) { for (bundle_file, $${bundle_data}.files) {
!contains(bundle_file, .*\.xcassets$): next() !contains(bundle_file, .*\\.xcassets$): next()
warning("*.xcassets in QMAKE_BUNDLE_DATA is deprecated. Use QMAKE_ASSET_CATALOGS instead.") warning("*.xcassets in QMAKE_BUNDLE_DATA is deprecated. Use QMAKE_ASSET_CATALOGS instead.")
!exists($$absolute_path($$bundle_file/AppIcon.appiconset, $$_PRO_FILE_PWD_)): next() !exists($$absolute_path($$bundle_file/AppIcon.appiconset, $$_PRO_FILE_PWD_)): next()

View File

@ -21,7 +21,7 @@ contains(TEMPLATE, .*app) {
!isEmpty($$list($$(QT_MAC_SDK_NO_VERSION_CHECK))): \ !isEmpty($$list($$(QT_MAC_SDK_NO_VERSION_CHECK))): \
CONFIG += sdk_no_version_check CONFIG += sdk_no_version_check
QMAKE_MAC_SDK_MAJOR_MINOR_VERSION = $$replace(QMAKE_MAC_SDK_VERSION, "(\d+)(\.\d+)(\.\d+)?", \1\2) QMAKE_MAC_SDK_MAJOR_MINOR_VERSION = $$replace(QMAKE_MAC_SDK_VERSION, "(\\d+)(\\.\\d+)(\\.\\d+)?", \\1\\2)
!sdk_no_version_check:!versionAtMost(QMAKE_MAC_SDK_MAJOR_MINOR_VERSION, $$QT_MAC_SDK_VERSION_MAX) { !sdk_no_version_check:!versionAtMost(QMAKE_MAC_SDK_MAJOR_MINOR_VERSION, $$QT_MAC_SDK_VERSION_MAX) {
warning("Qt has only been tested with version $$QT_MAC_SDK_VERSION_MAX"\ warning("Qt has only been tested with version $$QT_MAC_SDK_VERSION_MAX"\

View File

@ -38,7 +38,7 @@ if(gcc|intel_icl|msvc):!rim_qcc:!uikit:!no_moc_predefs:if(!macos|count(QMAKE_APP
} else: error("Oops, I messed up") } else: error("Oops, I messed up")
moc_predefs.output = $$MOC_DIR/moc_predefs.h moc_predefs.output = $$MOC_DIR/moc_predefs.h
moc_predefs.input = MOC_PREDEF_FILE moc_predefs.input = MOC_PREDEF_FILE
silent: moc_predefs.commands = @echo generating $$moc_predefs.output$$escape_expand(\n\t)@$$moc_predefs.commands silent: moc_predefs.commands = @echo generating $$moc_predefs.output$$escape_expand(\\n\\t)@$$moc_predefs.commands
QMAKE_EXTRA_COMPILERS += moc_predefs QMAKE_EXTRA_COMPILERS += moc_predefs
MOC_PREDEF_FILE = $$[QT_HOST_DATA/src]/mkspecs/features/data/dummy.cpp MOC_PREDEF_FILE = $$[QT_HOST_DATA/src]/mkspecs/features/data/dummy.cpp
} }

View File

@ -1196,9 +1196,9 @@ defineTest(qtConfTest_files) {
for(i, $${1}.files._KEYS_) { for(i, $${1}.files._KEYS_) {
f = $$eval($${1}.files.$${i}) f = $$eval($${1}.files.$${i})
qtLog("Searching for file $${f}.") qtLog("Searching for file $${f}.")
contains(f, ".*\.h") { contains(f, ".*\\.h") {
file = $$qtConfFindInPathList($$f, $$EXTRA_INCLUDEPATH $$QMAKE_DEFAULT_INCDIRS) file = $$qtConfFindInPathList($$f, $$EXTRA_INCLUDEPATH $$QMAKE_DEFAULT_INCDIRS)
} else: contains(f, ".*\.(lib|so|a)") { } else: contains(f, ".*\\.(lib|so|a)") {
file = $$qtConfFindInPathList($$f, $$EXTRA_LIBDIR $$QMAKE_DEFAULT_LIBDIRS) file = $$qtConfFindInPathList($$f, $$EXTRA_LIBDIR $$QMAKE_DEFAULT_LIBDIRS)
} else { } else {
# assume we're looking for an executable # assume we're looking for an executable
@ -1399,7 +1399,7 @@ defineReplace(qtConfEvaluate) {
1 ~= s/$$escape_expand(\\n) */ /g 1 ~= s/$$escape_expand(\\n) */ /g
expr = $${1} expr = $${1}
expr ~= s/&&/ && /g expr ~= s/&&/ && /g
expr ~= s/\|\|/ || /g expr ~= s/\\|\\|/ || /g
expr ~= s/!/ ! /g expr ~= s/!/ ! /g
expr ~= s/\\(/ ( /g expr ~= s/\\(/ ( /g
expr ~= s/\\)/ ) /g expr ~= s/\\)/ ) /g
@ -1422,7 +1422,7 @@ defineReplace(qtConfEvaluateSingleExpression) {
} else: contains(e, "^'.*'$") { } else: contains(e, "^'.*'$") {
# quoted literals # quoted literals
result = $$replace(e, "^'(.*)'$", "\\1") result = $$replace(e, "^'(.*)'$", "\\1")
} else: contains(e, "^tests\..*") { } else: contains(e, "^tests\\..*") {
!qt_conf_tests_allowed: \ !qt_conf_tests_allowed: \
error("Expression '$${1}' refers to a test, which is not allowed at this stage of configuring.") error("Expression '$${1}' refers to a test, which is not allowed at this stage of configuring.")
test = $$section(e, ".", 1, 1) test = $$section(e, ".", 1, 1)
@ -1433,7 +1433,7 @@ defineReplace(qtConfEvaluateSingleExpression) {
error("Unknown test object $${test} in expression '$${1}'.") error("Unknown test object $${test} in expression '$${1}'.")
qtRunSingleTest($$test) qtRunSingleTest($$test)
result = $$eval($${currentConfig}.tests.$${test}.$${var}) result = $$eval($${currentConfig}.tests.$${test}.$${var})
} else: contains(e, "^libs\..*") { } else: contains(e, "^libs\\..*") {
!qt_conf_tests_allowed: \ !qt_conf_tests_allowed: \
error("Expression '$${1}' refers to a library, which is not allowed at this stage of configuring.") error("Expression '$${1}' refers to a library, which is not allowed at this stage of configuring.")
lib = $$section(e, ".", 1, 1) lib = $$section(e, ".", 1, 1)
@ -1446,7 +1446,7 @@ defineReplace(qtConfEvaluateSingleExpression) {
!defined($${currentConfig}.libraries.$${lib}.$${var}, var): \ !defined($${currentConfig}.libraries.$${lib}.$${var}, var): \
var = sources.$$eval($${currentConfig}.libraries.$${lib}.source).$$var var = sources.$$eval($${currentConfig}.libraries.$${lib}.source).$$var
result = $$eval($${currentConfig}.libraries.$${lib}.$${var}) result = $$eval($${currentConfig}.libraries.$${lib}.$${var})
} else: contains(e, "^features\..*") { } else: contains(e, "^features\\..*") {
feature = $$section(e, ".", 1, 1) feature = $$section(e, ".", 1, 1)
var = $$section(e, ".", 2, -1) var = $$section(e, ".", 2, -1)
isEmpty(var): \ isEmpty(var): \
@ -1470,33 +1470,33 @@ defineReplace(qtConfEvaluateSingleExpression) {
!qtConfCheckFeature($$feature): \ !qtConfCheckFeature($$feature): \
error("Expression '$$1' is accessing non-emitted feature $${feature}.") error("Expression '$$1' is accessing non-emitted feature $${feature}.")
result = $$eval($${currentConfig}.features.$${feature}.$${var}) result = $$eval($${currentConfig}.features.$${feature}.$${var})
} else: contains(e, "^config\..*") { } else: contains(e, "^config\\..*") {
var = $$replace(e, "^config\.", "") var = $$replace(e, "^config\\.", "")
result = false result = false
contains(CONFIG, $$var): result = true contains(CONFIG, $$var): result = true
} else: contains(e, "^module\..*") { } else: contains(e, "^module\\..*") {
var = $$replace(e, "^module\.", "") var = $$replace(e, "^module\\.", "")
result = false result = false
qtConfHaveModule($$var): result = true qtConfHaveModule($$var): result = true
} else: contains(e, "^arch\..*") { } else: contains(e, "^arch\\..*") {
var = $$replace(e, "^arch\.", "") var = $$replace(e, "^arch\\.", "")
result = false result = false
isEmpty(QT_ARCH): \ isEmpty(QT_ARCH): \
qtConfCheckFeature(architecture) qtConfCheckFeature(architecture)
contains(QT_ARCH, $$var): result = true contains(QT_ARCH, $$var): result = true
} else: contains(e, "^subarch\..*") { } else: contains(e, "^subarch\\..*") {
var = $$replace(e, "^subarch\.", "") var = $$replace(e, "^subarch\\.", "")
result = false result = false
isEmpty(QT_ARCH): \ isEmpty(QT_ARCH): \
qtConfCheckFeature(architecture) qtConfCheckFeature(architecture)
contains(QT_CPU_FEATURES.$$QT_ARCH, $$var): result = true contains(QT_CPU_FEATURES.$$QT_ARCH, $$var): result = true
} else: contains(e, "^input\..*") { } else: contains(e, "^input\\..*") {
result = $$eval(config.$$e) result = $$eval(config.$$e)
} else: contains(e, "^var\..*") { } else: contains(e, "^var\\..*") {
var = $$replace(e, "^var\.", "") var = $$replace(e, "^var\\.", "")
result = $$eval($$var) result = $$eval($$var)
} else: contains(e, "^call\..*") { } else: contains(e, "^call\\..*") {
call = $$replace(e, "^call\.", "qtConfFunc_") call = $$replace(e, "^call\\.", "qtConfFunc_")
!defined($$call, replace): \ !defined($$call, replace): \
error("Call $$call referenced in expression '$${1}' does not exist") error("Call $$call referenced in expression '$${1}' does not exist")
eval(result = \$\$"$$call"()) eval(result = \$\$"$$call"())

View File

@ -18,7 +18,7 @@ isEmpty(qtver.value): error("No version for documentation specified.")
qtmver.name = QT_VER qtmver.name = QT_VER
qtmver.value = $$replace(qtver.value, ^(\\d+\\.\\d+).*$, \\1) qtmver.value = $$replace(qtver.value, ^(\\d+\\.\\d+).*$, \\1)
qtvertag.name = QT_VERSION_TAG qtvertag.name = QT_VERSION_TAG
qtvertag.value = $$replace(qtver.value, \.,) qtvertag.value = $$replace(qtver.value, \\.,)
qtdocs.name = QT_INSTALL_DOCS qtdocs.name = QT_INSTALL_DOCS
qtdocs.value = $$[QT_INSTALL_DOCS/src] qtdocs.value = $$[QT_INSTALL_DOCS/src]
builddir.name = BUILDDIR builddir.name = BUILDDIR

View File

@ -1,7 +1,7 @@
msvc { msvc {
# -MD becomes -MT, -MDd becomes -MTd # -MD becomes -MT, -MDd becomes -MTd
QMAKE_CFLAGS ~= s,^-MD(d?)$,-MT\1,g QMAKE_CFLAGS ~= s,^-MD(d?)$,-MT\\1,g
QMAKE_CXXFLAGS ~= s,^-MD(d?)$,-MT\1,g QMAKE_CXXFLAGS ~= s,^-MD(d?)$,-MT\\1,g
} else: mingw { } else: mingw {
QMAKE_LFLAGS += -static QMAKE_LFLAGS += -static
} }