|  | @@ -53,58 +53,6 @@ static std::size_t GetParallelCPUCount()
 | 
	
		
			
				|  |  |    return count;
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -static bool AddToSourceGroup(cmMakefile* makefile, std::string const& fileName,
 | 
	
		
			
				|  |  | -                             cmQtAutoGen::GenT genType)
 | 
	
		
			
				|  |  | -{
 | 
	
		
			
				|  |  | -  cmSourceGroup* sourceGroup = nullptr;
 | 
	
		
			
				|  |  | -  // Acquire source group
 | 
	
		
			
				|  |  | -  {
 | 
	
		
			
				|  |  | -    std::string property;
 | 
	
		
			
				|  |  | -    std::string groupName;
 | 
	
		
			
				|  |  | -    {
 | 
	
		
			
				|  |  | -      std::array<std::string, 2> props;
 | 
	
		
			
				|  |  | -      // Use generator specific group name
 | 
	
		
			
				|  |  | -      switch (genType) {
 | 
	
		
			
				|  |  | -        case cmQtAutoGen::GenT::MOC:
 | 
	
		
			
				|  |  | -          props[0] = "AUTOMOC_SOURCE_GROUP";
 | 
	
		
			
				|  |  | -          break;
 | 
	
		
			
				|  |  | -        case cmQtAutoGen::GenT::RCC:
 | 
	
		
			
				|  |  | -          props[0] = "AUTORCC_SOURCE_GROUP";
 | 
	
		
			
				|  |  | -          break;
 | 
	
		
			
				|  |  | -        default:
 | 
	
		
			
				|  |  | -          props[0] = "AUTOGEN_SOURCE_GROUP";
 | 
	
		
			
				|  |  | -          break;
 | 
	
		
			
				|  |  | -      }
 | 
	
		
			
				|  |  | -      props[1] = "AUTOGEN_SOURCE_GROUP";
 | 
	
		
			
				|  |  | -      for (std::string& prop : props) {
 | 
	
		
			
				|  |  | -        const char* propName = makefile->GetState()->GetGlobalProperty(prop);
 | 
	
		
			
				|  |  | -        if ((propName != nullptr) && (*propName != '\0')) {
 | 
	
		
			
				|  |  | -          groupName = propName;
 | 
	
		
			
				|  |  | -          property = std::move(prop);
 | 
	
		
			
				|  |  | -          break;
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -      }
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -    // Generate a source group on demand
 | 
	
		
			
				|  |  | -    if (!groupName.empty()) {
 | 
	
		
			
				|  |  | -      sourceGroup = makefile->GetOrCreateSourceGroup(groupName);
 | 
	
		
			
				|  |  | -      if (sourceGroup == nullptr) {
 | 
	
		
			
				|  |  | -        std::ostringstream ost;
 | 
	
		
			
				|  |  | -        ost << cmQtAutoGen::GeneratorNameUpper(genType);
 | 
	
		
			
				|  |  | -        ost << ": " << property;
 | 
	
		
			
				|  |  | -        ost << ": Could not find or create the source group ";
 | 
	
		
			
				|  |  | -        ost << cmQtAutoGen::Quoted(groupName);
 | 
	
		
			
				|  |  | -        cmSystemTools::Error(ost.str());
 | 
	
		
			
				|  |  | -        return false;
 | 
	
		
			
				|  |  | -      }
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -  }
 | 
	
		
			
				|  |  | -  if (sourceGroup != nullptr) {
 | 
	
		
			
				|  |  | -    sourceGroup->AddGroupFile(fileName);
 | 
	
		
			
				|  |  | -  }
 | 
	
		
			
				|  |  | -  return true;
 | 
	
		
			
				|  |  | -}
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |  static void AddCleanFile(cmMakefile* makefile, std::string const& fileName)
 | 
	
		
			
				|  |  |  {
 | 
	
		
			
				|  |  |    makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES", fileName.c_str(),
 | 
	
	
		
			
				|  | @@ -969,7 +917,7 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
 | 
	
		
			
				|  |  |    // Files provided by the autogen target
 | 
	
		
			
				|  |  |    std::vector<std::string> autogenProvides;
 | 
	
		
			
				|  |  |    if (this->Moc.Enabled) {
 | 
	
		
			
				|  |  | -    this->AddGeneratedSource(this->Moc.MocsCompilation, GenT::MOC, true);
 | 
	
		
			
				|  |  | +    this->AddGeneratedSource(this->Moc.MocsCompilation, this->Moc, true);
 | 
	
		
			
				|  |  |      autogenProvides.push_back(this->Moc.MocsCompilation);
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -1122,7 +1070,7 @@ bool cmQtAutoGenInitializer::InitRccTargets()
 | 
	
		
			
				|  |  |      // Register info file as generated by CMake
 | 
	
		
			
				|  |  |      makefile->AddCMakeOutputFile(qrc.InfoFile);
 | 
	
		
			
				|  |  |      // Register file at target
 | 
	
		
			
				|  |  | -    this->AddGeneratedSource(qrc.RccFile, GenT::RCC);
 | 
	
		
			
				|  |  | +    this->AddGeneratedSource(qrc.RccFile, this->Rcc);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      std::vector<std::string> ccOutput;
 | 
	
		
			
				|  |  |      ccOutput.push_back(qrc.RccFile);
 | 
	
	
		
			
				|  | @@ -1360,22 +1308,68 @@ bool cmQtAutoGenInitializer::SetupWriteRccInfo()
 | 
	
		
			
				|  |  |    return true;
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -void cmQtAutoGenInitializer::AddGeneratedSource(std::string const& filename,
 | 
	
		
			
				|  |  | -                                                GenT genType, bool prepend)
 | 
	
		
			
				|  |  | +void cmQtAutoGenInitializer::RegisterGeneratedSource(
 | 
	
		
			
				|  |  | +  std::string const& filename)
 | 
	
		
			
				|  |  |  {
 | 
	
		
			
				|  |  | -  // Register source file in makefile
 | 
	
		
			
				|  |  |    cmMakefile* makefile = this->Target->Target->GetMakefile();
 | 
	
		
			
				|  |  | -  {
 | 
	
		
			
				|  |  | -    cmSourceFile* gFile = makefile->GetOrCreateSource(filename, true);
 | 
	
		
			
				|  |  | -    gFile->SetProperty("GENERATED", "1");
 | 
	
		
			
				|  |  | -    gFile->SetProperty("SKIP_AUTOGEN", "On");
 | 
	
		
			
				|  |  | -  }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -  // Add source file to source group
 | 
	
		
			
				|  |  | -  AddToSourceGroup(makefile, filename, genType);
 | 
	
		
			
				|  |  | +  cmSourceFile* gFile = makefile->GetOrCreateSource(filename, true);
 | 
	
		
			
				|  |  | +  gFile->SetProperty("GENERATED", "1");
 | 
	
		
			
				|  |  | +  gFile->SetProperty("SKIP_AUTOGEN", "1");
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +bool cmQtAutoGenInitializer::AddGeneratedSource(std::string const& filename,
 | 
	
		
			
				|  |  | +                                                GenVarsT const& genVars,
 | 
	
		
			
				|  |  | +                                                bool prepend)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +  // Register source at makefile
 | 
	
		
			
				|  |  | +  this->RegisterGeneratedSource(filename);
 | 
	
		
			
				|  |  |    // Add source file to target
 | 
	
		
			
				|  |  |    this->Target->AddSource(filename, prepend);
 | 
	
		
			
				|  |  | +  // Add source file to source group
 | 
	
		
			
				|  |  | +  return this->AddToSourceGroup(filename, genVars.GenNameUpper);
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +bool cmQtAutoGenInitializer::AddToSourceGroup(std::string const& fileName,
 | 
	
		
			
				|  |  | +                                              std::string const& genNameUpper)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +  cmMakefile* makefile = this->Target->Target->GetMakefile();
 | 
	
		
			
				|  |  | +  cmSourceGroup* sourceGroup = nullptr;
 | 
	
		
			
				|  |  | +  // Acquire source group
 | 
	
		
			
				|  |  | +  {
 | 
	
		
			
				|  |  | +    std::string property;
 | 
	
		
			
				|  |  | +    std::string groupName;
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +      // Prefer generator specific source group name
 | 
	
		
			
				|  |  | +      std::array<std::string, 2> props{ { genNameUpper + "_SOURCE_GROUP",
 | 
	
		
			
				|  |  | +                                          "AUTOGEN_SOURCE_GROUP" } };
 | 
	
		
			
				|  |  | +      for (std::string& prop : props) {
 | 
	
		
			
				|  |  | +        const char* propName = makefile->GetState()->GetGlobalProperty(prop);
 | 
	
		
			
				|  |  | +        if ((propName != nullptr) && (*propName != '\0')) {
 | 
	
		
			
				|  |  | +          groupName = propName;
 | 
	
		
			
				|  |  | +          property = std::move(prop);
 | 
	
		
			
				|  |  | +          break;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    // Generate a source group on demand
 | 
	
		
			
				|  |  | +    if (!groupName.empty()) {
 | 
	
		
			
				|  |  | +      sourceGroup = makefile->GetOrCreateSourceGroup(groupName);
 | 
	
		
			
				|  |  | +      if (sourceGroup == nullptr) {
 | 
	
		
			
				|  |  | +        std::string err;
 | 
	
		
			
				|  |  | +        err += genNameUpper;
 | 
	
		
			
				|  |  | +        err += " error in ";
 | 
	
		
			
				|  |  | +        err += property;
 | 
	
		
			
				|  |  | +        err += ": Could not find or create the source group ";
 | 
	
		
			
				|  |  | +        err += cmQtAutoGen::Quoted(groupName);
 | 
	
		
			
				|  |  | +        cmSystemTools::Error(err);
 | 
	
		
			
				|  |  | +        return false;
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +  if (sourceGroup != nullptr) {
 | 
	
		
			
				|  |  | +    sourceGroup->AddGroupFile(fileName);
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +  return true;
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  static unsigned int CharPtrToUInt(const char* const input)
 |