summaryrefslogtreecommitdiffstats
path: root/qmake/generators/win32
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2014-11-20 16:20:16 +0100
committerOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2015-02-17 18:27:25 +0000
commitc0d67bb5c9370408ca68f21925de5ec9e89ad9cb (patch)
tree59b182b2e1f028a2f39a08c5a45aabfb5883ecb4 /qmake/generators/win32
parent6ccf0a326ef415b7c9c8d80e9ede0da85e2fb52b (diff)
fix filename handling in replaceExtraCompilerVariables()
fixing and escaping is now a tri-state option: - none (this removes the need to unescape the result right afterwards in some cases) - local shell (for system()) - target shell (for Makefile) Change-Id: I5b78d9b70630fe4484dc964eff5f62793da35764 Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Diffstat (limited to 'qmake/generators/win32')
-rw-r--r--qmake/generators/win32/msvc_objectmodel.cpp22
-rw-r--r--qmake/generators/win32/msvc_vcproj.cpp22
-rw-r--r--qmake/generators/win32/msvc_vcproj.h7
3 files changed, 28 insertions, 23 deletions
diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp
index 28a67d9902..62f5814ce3 100644
--- a/qmake/generators/win32/msvc_objectmodel.cpp
+++ b/qmake/generators/win32/msvc_objectmodel.cpp
@@ -2295,9 +2295,8 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info)
QString cmd, cmd_name, out;
QStringList deps, inputs;
// Variabel replacement of output name
- out = Option::fixPathToTargetOS(
- Project->replaceExtraCompilerVariables(tmp_out, inFile, QString()),
- false);
+ out = Option::fixPathToTargetOS(Project->replaceExtraCompilerVariables(
+ tmp_out, inFile, QString(), MakefileGenerator::NoShell), false);
// If file has built-in compiler, we've swapped the input and output of
// the command, as we in Visual Studio cannot have a Custom Buildstep on
@@ -2318,9 +2317,8 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info)
if (!tmp_dep_cmd.isEmpty()) {
// Execute dependency command, and add every line as a dep
char buff[256];
- QString dep_cmd = Project->replaceExtraCompilerVariables(tmp_dep_cmd,
- Option::fixPathToLocalOS(inFile, true, false),
- out);
+ QString dep_cmd = Project->replaceExtraCompilerVariables(
+ tmp_dep_cmd, inFile, out, MakefileGenerator::LocalShell);
if(Project->canExecute(dep_cmd)) {
dep_cmd.prepend(QLatin1String("cd ")
+ Project->escapeFilePath(Option::fixPathToLocalOS(Option::output_dir, false))
@@ -2347,7 +2345,8 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info)
}
for (int i = 0; i < deps.count(); ++i)
deps[i] = Option::fixPathToTargetOS(
- Project->replaceExtraCompilerVariables(deps.at(i), inFile, out),
+ Project->replaceExtraCompilerVariables(
+ deps.at(i), inFile, out, MakefileGenerator::NoShell),
false).trimmed();
// Command for file
if (combined) {
@@ -2367,16 +2366,19 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info)
// ### join gives path issues with directories containing spaces!
cmd = Project->replaceExtraCompilerVariables(tmp_cmd,
inputs.join(' '),
- out);
+ out,
+ MakefileGenerator::TargetShell);
} else {
deps.prepend(inFile); // input file itself too..
cmd = Project->replaceExtraCompilerVariables(tmp_cmd,
inFile,
- out);
+ out,
+ MakefileGenerator::TargetShell);
}
// Name for command
if (!tmp_cmd_name.isEmpty()) {
- cmd_name = Project->replaceExtraCompilerVariables(tmp_cmd_name, inFile, out);
+ cmd_name = Project->replaceExtraCompilerVariables(
+ tmp_cmd_name, inFile, out, MakefileGenerator::NoShell);
} else {
int space = cmd.indexOf(' ');
if (space != -1)
diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp
index 64252ff076..dd0fdafb49 100644
--- a/qmake/generators/win32/msvc_vcproj.cpp
+++ b/qmake/generators/win32/msvc_vcproj.cpp
@@ -893,7 +893,7 @@ void VcprojGenerator::init()
extraCompilerSources[file] += quc.toQString();
} else {
QString out = Option::fixPathToTargetOS(replaceExtraCompilerVariables(
- compiler_out, file, QString()), false);
+ compiler_out, file, QString(), NoShell), false);
extraCompilerSources[out] += quc.toQString();
extraCompilerOutputs[out] = QStringList(file); // Can only have one
}
@@ -1532,7 +1532,8 @@ void VcprojGenerator::initResourceFiles()
if(!qrc_files.isEmpty()) {
for (int i = 0; i < qrc_files.count(); ++i) {
char buff[256];
- QString dep_cmd = replaceExtraCompilerVariables(rcc_dep_cmd, qrc_files.at(i).toQString(), "");
+ QString dep_cmd = replaceExtraCompilerVariables(
+ rcc_dep_cmd, qrc_files.at(i).toQString(), QString(), LocalShell);
dep_cmd = Option::fixPathToLocalOS(dep_cmd, true, false);
if(canExecute(dep_cmd)) {
@@ -1605,16 +1606,16 @@ void VcprojGenerator::initExtraCompilerOutputs()
QString tmp_out = project->first(ProKey(*it + ".output")).toQString();
if (project->values(ProKey(*it + ".CONFIG")).indexOf("combine") != -1) {
// Combined output, only one file result
- extraCompile.addFile(
- Option::fixPathToTargetOS(replaceExtraCompilerVariables(tmp_out, QString(), QString()), false));
+ extraCompile.addFile(Option::fixPathToTargetOS(
+ replaceExtraCompilerVariables(tmp_out, QString(), QString(), NoShell), false));
} else {
// One output file per input
const ProStringList &tmp_in = project->values(project->first(ProKey(*it + ".input")).toKey());
for (int i = 0; i < tmp_in.count(); ++i) {
const QString &filename = tmp_in.at(i).toQString();
if (extraCompilerSources.contains(filename))
- extraCompile.addFile(
- Option::fixPathToTargetOS(replaceExtraCompilerVariables(filename, tmp_out, QString()), false));
+ extraCompile.addFile(Option::fixPathToTargetOS(
+ replaceExtraCompilerVariables(filename, tmp_out, QString(), NoShell), false));
}
}
} else {
@@ -1629,8 +1630,8 @@ void VcprojGenerator::initExtraCompilerOutputs()
for (int i = 0; i < tmp_in.count(); ++i) {
const QString &filename = tmp_in.at(i).toQString();
if (extraCompilerSources.contains(filename))
- extraCompile.addFile(
- Option::fixPathToTargetOS(replaceExtraCompilerVariables(filename, QString(), QString()), false));
+ extraCompile.addFile(Option::fixPathToTargetOS(
+ replaceExtraCompilerVariables(filename, QString(), QString(), NoShell), false));
}
}
}
@@ -1650,9 +1651,10 @@ VCProjectWriter *VcprojGenerator::createProjectWriter()
return new VCProjectWriter;
}
-QString VcprojGenerator::replaceExtraCompilerVariables(const QString &var, const QStringList &in, const QStringList &out)
+QString VcprojGenerator::replaceExtraCompilerVariables(
+ const QString &var, const QStringList &in, const QStringList &out, ReplaceFor forShell)
{
- QString ret = MakefileGenerator::replaceExtraCompilerVariables(var, in, out);
+ QString ret = MakefileGenerator::replaceExtraCompilerVariables(var, in, out, forShell);
ProStringList &defines = project->values("VCPROJ_MAKEFILE_DEFINES");
if(defines.isEmpty())
diff --git a/qmake/generators/win32/msvc_vcproj.h b/qmake/generators/win32/msvc_vcproj.h
index 7d912616fd..87cc39f323 100644
--- a/qmake/generators/win32/msvc_vcproj.h
+++ b/qmake/generators/win32/msvc_vcproj.h
@@ -76,9 +76,10 @@ protected:
virtual VCProjectWriter *createProjectWriter();
virtual bool doDepends() const { return false; } //never necesary
virtual void processSources() { filterIncludedFiles("SOURCES"); filterIncludedFiles("GENERATED_SOURCES"); }
- virtual QString replaceExtraCompilerVariables(const QString &, const QStringList &, const QStringList &);
- inline QString replaceExtraCompilerVariables(const QString &val, const QString &in, const QString &out)
- { return MakefileGenerator::replaceExtraCompilerVariables(val, in, out); }
+ using MakefileGenerator::ReplaceFor;
+ virtual QString replaceExtraCompilerVariables(const QString &, const QStringList &, const QStringList &, ReplaceFor);
+ inline QString replaceExtraCompilerVariables(const QString &val, const QString &in, const QString &out, ReplaceFor forShell)
+ { return MakefileGenerator::replaceExtraCompilerVariables(val, in, out, forShell); }
virtual bool supportsMetaBuild() { return true; }
virtual bool supportsMergedBuilds() { return true; }
virtual bool mergeBuildProject(MakefileGenerator *other);