From 3e01f1ad3b19880628cf26e5395d34a1a9f2af05 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 18 Sep 2015 21:02:37 +0200 Subject: [PATCH] make processPrlFile() munge the path less when replacing the target don't prepend the normalized path to the target name, but replace only the filename in the original string. this ensures that any variables in the path are preserved. Change-Id: I58c2b54b7114bfdbf659e6a6ce3e02c2611900d4 Reviewed-by: Joerg Bornemann --- qmake/generators/makefile.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index e329fe28981..b4190311ed2 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -877,7 +877,6 @@ MakefileGenerator::processPrlFile(QString &file) if(QMakeMetaInfo::libExists(file)) { try_replace_file = true; meta_file = file; - file = ""; } else { QString tmp = file; int ext = tmp.lastIndexOf('.'); @@ -904,14 +903,14 @@ MakefileGenerator::processPrlFile(QString &file) foreach (const ProString &def, libinfo.values("QMAKE_PRL_DEFINES")) if (!defs.contains(def) && prl_defs.contains(def)) defs.append(def); - if(try_replace_file && !libinfo.isEmpty("QMAKE_PRL_TARGET")) { - QString dir; - int slsh = real_meta_file.lastIndexOf('/'); - if(slsh != -1) - dir = real_meta_file.left(slsh+1); - file = libinfo.first("QMAKE_PRL_TARGET").toQString(); - if(QDir::isRelativePath(file)) - file.prepend(dir); + if (try_replace_file) { + ProString tgt = libinfo.first("QMAKE_PRL_TARGET"); + if (!tgt.isEmpty()) { + int off = qMax(file.lastIndexOf('/'), file.lastIndexOf('\\')) + 1; + debug_msg(1, " Replacing library reference %s with %s", + file.mid(off).toLatin1().constData(), tgt.toQString().toLatin1().constData()); + file.replace(off, 1000, tgt.toQString()); + } } } }