From 360c3427117312548358fddce906a346f17b8f5f Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Fri, 2 Dec 2016 16:24:51 +0100 Subject: 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. --- Source/cmQtAutoGeneratorInitializer.cxx | 26 +++++++++++++++----------- 1 file 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 srcFiles; target->GetConfigCommonSourceFiles(srcFiles); - std::vector newRccFiles; + std::vector rccOutput; cmFilePathChecksum fpathCheckSum(makefile); for (std::vector::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::const_iterator fileIt = newRccFiles.begin(); - fileIt != newRccFiles.end(); ++fileIt) { - const_cast(target)->AddSource(*fileIt); + // Add rcc output files as sources + for (std::vector::const_iterator fileIt = rccOutput.begin(); + fileIt != rccOutput.end(); ++fileIt) { + const std::string& rccOutputFile = *fileIt; + // Add source + makefile->GetOrCreateSource(rccOutputFile, true); + const_cast(target)->AddSource(rccOutputFile); + // Create output directory + cmSystemTools::MakeDirectory( + cmsys::SystemTools::GetFilenamePath(rccOutputFile)); } } -- cgit v0.12