summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmQtAutoGenerators.cxx120
-rw-r--r--Source/cmQtAutoGenerators.h2
2 files changed, 76 insertions, 46 deletions
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index b75868e..c07a0a6 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -1351,64 +1351,92 @@ bool cmQtAutoGenerators::InputFilesNewerThanQrc(const std::string& qrcFile,
bool cmQtAutoGenerators::GenerateQrcFiles()
{
+ // generate single map with input / output names
+ std::map<std::string, std::string> qrcGenMap;
for(std::vector<std::string>::const_iterator si = this->RccSources.begin();
si != this->RccSources.end(); ++si)
{
- std::string ext = cmsys::SystemTools::GetFilenameLastExtension(*si);
-
- if (ext != ".qrc")
+ const std::string ext = cmsys::SystemTools::GetFilenameLastExtension(*si);
+ if (ext == ".qrc")
{
- continue;
+ std::string basename = cmsys::SystemTools::
+ GetFilenameWithoutLastExtension(*si);
+ std::string qrcOutputFile = "CMakeFiles/" + this->OriginTargetName
+ + ".dir/qrc_" + basename + ".cpp";
+ qrcGenMap[*si] = qrcOutputFile;
}
- std::vector<std::string> command;
- command.push_back(this->RccExecutable);
+ }
- std::string basename = cmsys::SystemTools::
- GetFilenameWithoutLastExtension(*si);
+ // generate qrc files
+ for(std::map<std::string, std::string>::const_iterator
+ si = qrcGenMap.begin(); si != qrcGenMap.end(); ++si)
+ {
+ if (!this->GenerateQrc( si->first, si->second))
+ {
+ if (this->RunRccFailed)
+ {
+ return false;
+ }
+ }
+ }
+ return true;
+}
- std::string rcc_output_file = this->Builddir
- + "CMakeFiles/" + this->OriginTargetName
- + ".dir/qrc_" + basename + ".cpp";
+bool cmQtAutoGenerators::GenerateQrc (
+ const std::string& qrcInputFile,
+ const std::string& qrcOutputFile )
+{
+ const std::string basename = cmsys::SystemTools::
+ GetFilenameWithoutLastExtension(qrcInputFile);
+ const ::std::string qrcBuildFile = this->Builddir + qrcOutputFile;
+
+ int sourceNewerThanQrc = 0;
+ bool generateQrc = !cmsys::SystemTools::FileTimeCompare(qrcInputFile,
+ qrcBuildFile,
+ &sourceNewerThanQrc);
+ generateQrc = generateQrc || (sourceNewerThanQrc >= 0);
+ generateQrc = generateQrc || this->InputFilesNewerThanQrc(qrcInputFile,
+ qrcBuildFile);
+
+ if (this->GenerateAll || generateQrc)
+ {
+ std::string msg = "Generating ";
+ msg += qrcOutputFile;
+ cmSystemTools::MakefileColorEcho(cmsysTerminal_Color_ForegroundBlue
+ |cmsysTerminal_Color_ForegroundBold,
+ msg.c_str(), true, this->ColorOutput);
- int sourceNewerThanQrc = 0;
- bool generateQrc = !cmsys::SystemTools::FileTimeCompare(*si,
- rcc_output_file,
- &sourceNewerThanQrc);
- generateQrc = generateQrc || (sourceNewerThanQrc >= 0);
- generateQrc = generateQrc || this->InputFilesNewerThanQrc(*si,
- rcc_output_file);
+ std::vector<std::string> command;
+ command.push_back(this->RccExecutable);
- if (this->GenerateAll || generateQrc)
+ std::map<std::string, std::string>::const_iterator optionIt
+ = this->RccOptions.find(qrcInputFile);
+ if (optionIt != this->RccOptions.end())
{
- std::map<std::string, std::string>::const_iterator optionIt
- = this->RccOptions.find(*si);
- if (optionIt != this->RccOptions.end())
- {
- cmSystemTools::ExpandListArgument(optionIt->second, command);
- }
+ cmSystemTools::ExpandListArgument(optionIt->second, command);
+ }
- command.push_back("-name");
- command.push_back(basename);
- command.push_back("-o");
- command.push_back(rcc_output_file);
- command.push_back(*si);
+ command.push_back("-name");
+ command.push_back(basename);
+ command.push_back("-o");
+ command.push_back(qrcBuildFile);
+ command.push_back(qrcInputFile);
- if (this->Verbose)
- {
- this->LogCommand(command);
- }
- std::string output;
- int retVal = 0;
- bool result = cmSystemTools::RunSingleCommand(command, &output, &output,
- &retVal);
- if (!result || retVal)
- {
- std::cerr << "AUTORCC: error: process for " << rcc_output_file <<
- " failed:\n" << output << std::endl;
- this->RunRccFailed = true;
- cmSystemTools::RemoveFile(rcc_output_file);
- return false;
- }
+ if (this->Verbose)
+ {
+ this->LogCommand(command);
+ }
+ std::string output;
+ int retVal = 0;
+ bool result = cmSystemTools::RunSingleCommand(command, &output, &output,
+ &retVal);
+ if (!result || retVal)
+ {
+ std::cerr << "AUTORCC: error: process for " << qrcOutputFile <<
+ " failed:\n" << output << std::endl;
+ this->RunRccFailed = true;
+ cmSystemTools::RemoveFile(qrcBuildFile);
+ return false;
}
}
return true;
diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h
index d532c21..68ab480 100644
--- a/Source/cmQtAutoGenerators.h
+++ b/Source/cmQtAutoGenerators.h
@@ -50,6 +50,8 @@ private:
const std::string& uiInputFile,
const std::string& uiOutputFile );
bool GenerateQrcFiles();
+ bool GenerateQrc(const std::string& qrcInputFile,
+ const std::string& qrcOutputFile);
void ParseCppFile(const std::string& absFilename,
const std::vector<std::string>& headerExtensions,
std::map<std::string, std::string>& includedMocs,