|
|
@@ -1664,10 +1664,10 @@ bool cmQtAutoGenerators::RccGenerateFile(const std::string& rccInputFile,
|
|
|
{
|
|
|
bool rccGenerated = false;
|
|
|
bool generateRcc = this->RccSettingsChanged;
|
|
|
-
|
|
|
const std::string rccBuildFile =
|
|
|
cmSystemTools::CollapseCombinedPath(this->AutogenBuildDir, rccOutputFile);
|
|
|
|
|
|
+ // Check if regeneration is required
|
|
|
if (!generateRcc) {
|
|
|
// Test if the resources list file is newer than build file
|
|
|
generateRcc = FileAbsentOrOlder(rccBuildFile, rccInputFile);
|
|
|
@@ -1700,6 +1700,7 @@ bool cmQtAutoGenerators::RccGenerateFile(const std::string& rccInputFile,
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ // Regenerate on demand
|
|
|
if (generateRcc) {
|
|
|
// Log
|
|
|
this->LogBold("Generating RCC source " + rccOutputFile);
|
|
|
@@ -1755,6 +1756,39 @@ bool cmQtAutoGenerators::RccGenerateFile(const std::string& rccInputFile,
|
|
|
this->RccRunFailed = true;
|
|
|
}
|
|
|
}
|
|
|
+ // For a multi configuration generator generate a wrapper file
|
|
|
+ if (!this->ConfigSuffix.empty() && !this->RccRunFailed) {
|
|
|
+ // Wrapper file name
|
|
|
+ const std::string cppSuffix = ".cpp";
|
|
|
+ const size_t suffixLength = this->ConfigSuffix.size() + cppSuffix.size();
|
|
|
+ const std::string wrapperFileRel =
|
|
|
+ rccOutputFile.substr(0, rccOutputFile.size() - suffixLength) + cppSuffix;
|
|
|
+ const std::string wrapperFileAbs = cmSystemTools::CollapseCombinedPath(
|
|
|
+ this->AutogenBuildDir, wrapperFileRel);
|
|
|
+ // Wrapper file content
|
|
|
+ std::string content =
|
|
|
+ "// This is an autogenerated configuration wrapper file. Do not edit.\n"
|
|
|
+ "#include \"";
|
|
|
+ content += cmsys::SystemTools::GetFilenameName(rccBuildFile);
|
|
|
+ content += "\"\n";
|
|
|
+ // Write content to file
|
|
|
+ if (this->FileDiffers(wrapperFileAbs, content)) {
|
|
|
+ // Write new wrapper file if the content differs
|
|
|
+ this->LogBold("Generating RCC wrapper " + wrapperFileRel);
|
|
|
+ if (!this->FileWrite("AutoRcc", wrapperFileAbs, content)) {
|
|
|
+ // Error
|
|
|
+ rccGenerated = false;
|
|
|
+ this->RccRunFailed = true;
|
|
|
+ }
|
|
|
+ } else if (rccGenerated) {
|
|
|
+ // Only touch wrapper file if the content matches
|
|
|
+ if (this->Verbose) {
|
|
|
+ this->LogInfo("Touching RCC wrapper " + wrapperFileRel);
|
|
|
+ }
|
|
|
+ cmSystemTools::Touch(wrapperFileAbs, false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
return rccGenerated;
|
|
|
}
|
|
|
|