Autogen: Read relative paths from rcc output

This commit is contained in:
Sebastian Holtermann
2017-09-14 20:51:12 +02:00
parent 8bee55bce1
commit 3f22374339

View File

@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmQtAutoGen.h"
#include "cmAlgorithms.h"
#include "cmProcessOutput.h"
#include "cmSystemTools.h"
#include "cmsys/FStream.hxx"
@@ -158,15 +159,18 @@ static bool RccListInputsQt5(const std::string& rccCommand,
std::string rccStdOut;
std::string rccStdErr;
int retVal = 0;
bool result =
cmSystemTools::RunSingleCommand(command, &rccStdOut, &rccStdErr, &retVal,
nullptr, cmSystemTools::OUTPUT_NONE);
bool result = cmSystemTools::RunSingleCommand(
command, &rccStdOut, &rccStdErr, &retVal, nullptr,
cmSystemTools::OUTPUT_NONE, 0.0, cmProcessOutput::Auto);
if (result && retVal == 0 &&
rccStdOut.find("--list") != std::string::npos) {
hasDashDashList = true;
}
}
std::string const fileDir = cmSystemTools::GetFilenamePath(fileName);
std::string const fileNameName = cmSystemTools::GetFilenameName(fileName);
// Run rcc list command
bool result = false;
int retVal = 0;
@@ -176,16 +180,16 @@ static bool RccListInputsQt5(const std::string& rccCommand,
std::vector<std::string> command;
command.push_back(rccCommand);
command.push_back(hasDashDashList ? "--list" : "-list");
command.push_back(fileName);
result =
cmSystemTools::RunSingleCommand(command, &rccStdOut, &rccStdErr, &retVal,
nullptr, cmSystemTools::OUTPUT_NONE);
command.push_back(fileNameName);
result = cmSystemTools::RunSingleCommand(
command, &rccStdOut, &rccStdErr, &retVal, fileDir.c_str(),
cmSystemTools::OUTPUT_NONE, 0.0, cmProcessOutput::Auto);
}
if (!result || retVal) {
if (errorMessage != nullptr) {
std::ostringstream ost;
ost << "rcc list process for " << cmQtAutoGen::Quoted(fileName)
<< " failed:\n"
ost << "rcc list process failed for\n " << cmQtAutoGen::Quoted(fileName)
<< "\n"
<< rccStdOut << "\n"
<< rccStdErr << "\n";
*errorMessage = ost.str();
@@ -230,6 +234,11 @@ static bool RccListInputsQt5(const std::string& rccCommand,
}
}
// Convert relative paths to absolute paths
for (std::string& resFile : files) {
resFile = cmSystemTools::CollapseCombinedPath(fileDir, resFile);
}
return true;
}