summaryrefslogtreecommitdiffstats
path: root/qmake/generators
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2020-01-02 14:16:21 +0100
committerJoerg Bornemann <joerg.bornemann@qt.io>2020-01-24 13:24:59 +0100
commit16885a6033405e1ed28ac42f9dfec7339975e85e (patch)
treeba47180061a62d458b4f0b21c0addd70a6f298d0 /qmake/generators
parent39396409656b12940ffe9b715f13e23ac4290eca (diff)
De-duplicate the last occurrence of calling a depend_command
Use the central callExtraCompilerDependCommand in the last place where the code to call an extra compiler's depend_command was duplicated. Note that this is in the "Bad hack" section. We're making this hack less bad, but the comment still applies. Change-Id: Iaa857af20ca46b2d73053d3e264c63124c87a41b Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'qmake/generators')
-rw-r--r--qmake/generators/win32/msvc_vcproj.cpp44
1 files changed, 16 insertions, 28 deletions
diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp
index 867b14faea..80f444820a 100644
--- a/qmake/generators/win32/msvc_vcproj.cpp
+++ b/qmake/generators/win32/msvc_vcproj.cpp
@@ -1481,36 +1481,24 @@ void VcprojGenerator::initResourceFiles()
// Bad hack, please look away -------------------------------------
QString rcc_dep_cmd = project->values("rcc.depend_command").join(' ');
if(!rcc_dep_cmd.isEmpty()) {
- ProStringList qrc_files = project->values("RESOURCES");
+ const QStringList qrc_files = project->values("RESOURCES").toQStringList();
QStringList deps;
- 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(), LocalShell);
-
- dep_cmd = Option::fixPathToLocalOS(dep_cmd, true, false);
- if(canExecute(dep_cmd)) {
- dep_cmd.prepend(QLatin1String("cd ")
- + IoUtils::shellQuote(Option::fixPathToLocalOS(Option::output_dir, false))
- + QLatin1String(" && "));
- if (FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), QT_POPEN_READ)) {
- QString indeps;
- while(!feof(proc)) {
- int read_in = (int)fread(buff, 1, 255, proc);
- if(!read_in)
- break;
- indeps += QByteArray(buff, read_in);
- }
- QT_PCLOSE(proc);
- if(!indeps.isEmpty())
- deps += fileFixify(indeps.replace('\n', ' ').simplified().split(' '),
- FileFixifyFromOutdir);
- }
- }
- }
- vcProject.ResourceFiles.addFiles(deps);
+ const QString rcc_dep_cd_cmd = QLatin1String("cd ")
+ + IoUtils::shellQuote(Option::fixPathToLocalOS(Option::output_dir, false))
+ + QLatin1String(" && ");
+ for (const QString &qrc_file : qrc_files) {
+ callExtraCompilerDependCommand("rcc",
+ rcc_dep_cd_cmd,
+ rcc_dep_cmd,
+ qrc_file,
+ QString(),
+ true, // dep_lines
+ &deps,
+ false, // existingDepsOnly
+ true // checkCommandavailability
+ );
}
+ vcProject.ResourceFiles.addFiles(deps);
}
// You may look again --------------------------------------------