QtAutogen: Reconfigure when .qrc file changes

Add .qrc files to the CMake depends.
When the .qrc file changes the build system gets reconfigured
and the resource files watch list gets updated.
This commit is contained in:
Sebastian Holtermann 2016-12-02 16:24:51 +01:00 committed by Brad King
parent b5409d04f1
commit 360c342711

View File

@ -109,7 +109,7 @@ static void SetupSourceFiles(cmGeneratorTarget const* target,
std::vector<cmSourceFile*> srcFiles;
target->GetConfigCommonSourceFiles(srcFiles);
std::vector<std::string> newRccFiles;
std::vector<std::string> rccOutput;
cmFilePathChecksum fpathCheckSum(makefile);
for (std::vector<cmSourceFile*>::const_iterator fileIt = srcFiles.begin();
@ -127,19 +127,16 @@ static void SetupSourceFiles(cmGeneratorTarget const* target,
if (ext == "qrc" &&
!cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTORCC"))) {
// Run cmake again when .qrc file changes
makefile->AddCMakeDependFile ( absFile );
std::string rccOutputFile = GetAutogenTargetBuildDir(target);
rccOutputFile += fpathCheckSum.getPart(absFile);
rccOutputFile += "/qrc_";
rccOutputFile +=
cmsys::SystemTools::GetFilenameWithoutLastExtension(absFile);
rccOutputFile += ".cpp";
makefile->GetOrCreateSource(rccOutputFile, true);
newRccFiles.push_back(rccOutputFile);
// Create output directory
cmSystemTools::MakeDirectory(
cmsys::SystemTools::GetFilenamePath(rccOutputFile));
rccOutput.push_back(rccOutputFile);
}
}
@ -158,9 +155,16 @@ static void SetupSourceFiles(cmGeneratorTarget const* target,
}
}
for (std::vector<std::string>::const_iterator fileIt = newRccFiles.begin();
fileIt != newRccFiles.end(); ++fileIt) {
const_cast<cmGeneratorTarget*>(target)->AddSource(*fileIt);
// Add rcc output files as sources
for (std::vector<std::string>::const_iterator fileIt = rccOutput.begin();
fileIt != rccOutput.end(); ++fileIt) {
const std::string& rccOutputFile = *fileIt;
// Add source
makefile->GetOrCreateSource(rccOutputFile, true);
const_cast<cmGeneratorTarget*>(target)->AddSource(rccOutputFile);
// Create output directory
cmSystemTools::MakeDirectory(
cmsys::SystemTools::GetFilenamePath(rccOutputFile));
}
}