浏览代码

Autogen: Remove per-config suffix for mocs_compilations.cpp

Sebastian Holtermann 8 年之前
父节点
当前提交
e2c9cf12d1
共有 2 个文件被更改,包括 9 次插入29 次删除
  1. 6 24
      Source/cmQtAutoGeneratorInitializer.cxx
  2. 3 5
      Source/cmQtAutoGenerators.cxx

+ 6 - 24
Source/cmQtAutoGeneratorInitializer.cxx

@@ -707,24 +707,11 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenSources(
 {
   if (target->GetPropertyAsBool("AUTOMOC")) {
     cmMakefile* makefile = target->Target->GetMakefile();
-    const std::vector<std::string> suffixes =
-      GetConfigurationSuffixes(makefile);
-    // Get build directory
-    const std::string autogenBuildDir = GetAutogenTargetBuildDir(target);
-    // Register all compilation files as generated
-    for (std::vector<std::string>::const_iterator it = suffixes.begin();
-         it != suffixes.end(); ++it) {
-      std::string mcFile = autogenBuildDir + "/mocs_compilation";
-      mcFile += *it;
-      mcFile += ".cpp";
-      AddGeneratedSource(makefile, mcFile, cmQtAutoGeneratorCommon::MOC);
-    }
     // Mocs compilation file
-    if (IsMultiConfig(target->GetGlobalGenerator())) {
-      target->AddSource(autogenBuildDir + "/mocs_compilation_$<CONFIG>.cpp");
-    } else {
-      target->AddSource(autogenBuildDir + "/mocs_compilation.cpp");
-    }
+    const std::string mocsComp =
+      GetAutogenTargetBuildDir(target) + "/mocs_compilation.cpp";
+    AddGeneratedSource(makefile, mocsComp, cmQtAutoGeneratorCommon::MOC);
+    target->AddSource(mocsComp);
   }
 }
 
@@ -803,13 +790,8 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
 
   // Add moc compilation to generated files list
   if (mocEnabled) {
-    for (std::vector<std::string>::const_iterator it = suffixes.begin();
-         it != suffixes.end(); ++it) {
-      std::string mcFile = autogenBuildDir + "/mocs_compilation";
-      mcFile += *it;
-      mcFile += ".cpp";
-      autogenProvides.push_back(mcFile);
-    }
+    const std::string mocsComp = autogenBuildDir + "/mocs_compilation.cpp";
+    autogenProvides.push_back(mocsComp);
   }
 
   // Add autogen includes directory to the origin target INCLUDE_DIRECTORIES

+ 3 - 5
Source/cmQtAutoGenerators.cxx

@@ -636,9 +636,7 @@ bool cmQtAutoGenerators::SettingsFileWrite()
 void cmQtAutoGenerators::Init(cmMakefile* makefile)
 {
   // Mocs compilation file
-  this->MocCompFileRel = "mocs_compilation";
-  this->MocCompFileRel += this->ConfigSuffix;
-  this->MocCompFileRel += ".cpp";
+  this->MocCompFileRel = "mocs_compilation.cpp";
   this->MocCompFileAbs = cmSystemTools::CollapseCombinedPath(
     this->AutogenBuildDir, this->MocCompFileRel);
 
@@ -724,10 +722,10 @@ bool cmQtAutoGenerators::RunAutogen()
   // the program goes through all .cpp files to see which moc files are
   // included. It is not really interesting how the moc file is named, but
   // what file the moc is created from. Once a moc is included the same moc
-  // may not be included in the mocs_compilation_$<CONFIG>.cpp file anymore.
+  // may not be included in the mocs_compilation.cpp file anymore.
   // OTOH if there's a header containing Q_OBJECT where no corresponding
   // moc file is included anywhere a moc_<filename>.cpp file is created and
-  // included in the mocs_compilation_$<CONFIG>.cpp file.
+  // included in the mocs_compilation.cpp file.
 
   // key = moc source filepath, value = moc output filepath
   std::map<std::string, std::string> mocsIncluded;