From 16885a6033405e1ed28ac42f9dfec7339975e85e Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 2 Jan 2020 14:16:21 +0100 Subject: 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 --- qmake/generators/win32/msvc_vcproj.cpp | 44 +++++++++++++--------------------- 1 file changed, 16 insertions(+), 28 deletions(-) (limited to 'qmake/generators/win32') 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 -------------------------------------------- -- cgit v1.2.1