diff options
author | Sebastian Holtermann <sebholt@xwmw.org> | 2016-12-02 15:24:51 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-12-07 13:24:03 (GMT) |
commit | 360c3427117312548358fddce906a346f17b8f5f (patch) | |
tree | b87e12cbe0478d59c4e01a87ab4972777aa2610f | |
parent | b5409d04f1c1309deb7e45163a106c8cb4daf38c (diff) | |
download | CMake-360c3427117312548358fddce906a346f17b8f5f.zip CMake-360c3427117312548358fddce906a346f17b8f5f.tar.gz CMake-360c3427117312548358fddce906a346f17b8f5f.tar.bz2 |
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.
-rw-r--r-- | Source/cmQtAutoGeneratorInitializer.cxx | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx index 889c61d..76fb8e5 100644 --- a/Source/cmQtAutoGeneratorInitializer.cxx +++ b/Source/cmQtAutoGeneratorInitializer.cxx @@ -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)); } } |