From d8e45536fb3637454cf17a638dcd9fc236e94660 Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Sat, 31 Dec 2016 11:17:07 +0100 Subject: [PATCH] AUTOGEN: Initializer: Always remember skipped files --- Source/cmQtAutoGeneratorInitializer.cxx | 57 ++++++++++++++----------- 1 file changed, 33 insertions(+), 24 deletions(-) diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx index b74fbf32ee..6d4c302fe6 100644 --- a/Source/cmQtAutoGeneratorInitializer.cxx +++ b/Source/cmQtAutoGeneratorInitializer.cxx @@ -101,14 +101,17 @@ static std::string GetQtMajorVersion(cmGeneratorTarget const* target) static void SetupSourceFiles(cmGeneratorTarget const* target, std::vector& mocUicSources, std::vector& mocUicHeaders, - std::vector& skipMoc, - std::vector& skipUic) + std::vector& skipMocList, + std::vector& skipUicList) { cmMakefile* makefile = target->Target->GetMakefile(); std::vector srcFiles; target->GetConfigCommonSourceFiles(srcFiles); + const bool targetMoc = target->GetPropertyAsBool("AUTOMOC"); + const bool targetUic = target->GetPropertyAsBool("AUTOUIC"); + cmFilePathChecksum fpathCheckSum(makefile); for (std::vector::const_iterator fileIt = srcFiles.begin(); fileIt != srcFiles.end(); ++fileIt) { @@ -123,32 +126,38 @@ static void SetupSourceFiles(cmGeneratorTarget const* target, if (cmSystemTools::IsOn(sf->GetPropertyForUser("GENERATED"))) { continue; } - if (cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTOGEN"))) { - continue; - } - const bool fileSkipUic = - cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTOUIC")); - const bool fileSkipMoc = - cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTOMOC")); - if (fileSkipUic && fileSkipMoc) { - continue; - } - - // Use file const std::string absFile = cmsys::SystemTools::GetRealPath(sf->GetFullPath()); - // Add file name to sources or headers list - if (fileType == cmSystemTools::CXX_FILE_FORMAT) { - mocUicSources.push_back(absFile); - } else if (fileType == cmSystemTools::HEADER_FILE_FORMAT) { - mocUicHeaders.push_back(absFile); + // Skip flags + const bool skipAll = + cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTOGEN")); + const bool skipMoc = + skipAll || cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTOMOC")); + const bool skipUic = + skipAll || cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTOUIC")); + // Add file name to skip lists. + // Do this even when the file is not added to the sources/headers lists + // because the file name may be extracted from an other file when + // processing + if (skipMoc) { + skipMocList.push_back(absFile); } - // Add file name to skip lists on demand - if (fileSkipUic) { - skipUic.push_back(absFile); + if (skipUic) { + skipUicList.push_back(absFile); } - if (fileSkipMoc) { - skipMoc.push_back(absFile); + + if ((targetMoc && !skipMoc) || (targetUic && !skipUic)) { + // Add file name to sources or headers list + switch (fileType) { + case cmSystemTools::CXX_FILE_FORMAT: + mocUicSources.push_back(absFile); + break; + case cmSystemTools::HEADER_FILE_FORMAT: + mocUicHeaders.push_back(absFile); + break; + default: + break; + } } } }