QtAutogen: Fix rcc invocation for Qt 5.0 and 5.1 (#15644)

In commit v3.2.0-rc1~480^2 (QtAutogen: Regenerate qrc files if their
input changes, 2014-09-17) we added use of the rcc `--list` option.
Prior to Qt 5.2 this option was called just `-list`.  Run `rcc --help`
to check for support for `--list` before using it and otherwise fall
back to the `-list` option for compatibility with older versions.
This commit is contained in:
Brad King 2015-10-28 09:00:51 -04:00
parent 5ba3209247
commit e78fcc6329
1 changed files with 20 additions and 1 deletions

View File

@ -490,11 +490,30 @@ static std::string ListQt5RccInputs(cmSourceFile* sf,
{ {
std::string rccCommand std::string rccCommand
= GetRccExecutable(target); = GetRccExecutable(target);
bool hasDashDashList = false;
{
std::vector<std::string> command;
command.push_back(rccCommand);
command.push_back("--help");
std::string rccStdOut;
std::string rccStdErr;
int retVal = 0;
bool result = cmSystemTools::RunSingleCommand(
command, &rccStdOut, &rccStdErr,
&retVal, 0, cmSystemTools::OUTPUT_NONE);
if (result && retVal == 0 &&
rccStdOut.find("--list") != std::string::npos)
{
hasDashDashList = true;
}
}
std::vector<std::string> qrcEntries; std::vector<std::string> qrcEntries;
std::vector<std::string> command; std::vector<std::string> command;
command.push_back(rccCommand); command.push_back(rccCommand);
command.push_back("--list"); command.push_back(hasDashDashList? "--list" : "-list");
std::string absFile = cmsys::SystemTools::GetRealPath( std::string absFile = cmsys::SystemTools::GetRealPath(
sf->GetFullPath()); sf->GetFullPath());