diff options
Diffstat (limited to 'Source/cmGlobalXCodeGenerator.cxx')
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index df671c2..4481bdc 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -841,6 +841,19 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile( return buildFile; } +void cmGlobalXCodeGenerator::AddXCodeProjBuildRule( + cmGeneratorTarget* target, std::vector<cmSourceFile*>& sources) const +{ + std::string listfile = + target->GetLocalGenerator()->GetCurrentSourceDirectory(); + listfile += "/CMakeLists.txt"; + cmSourceFile* srcCMakeLists = target->Makefile->GetOrCreateSource(listfile); + if (std::find(sources.begin(), sources.end(), srcCMakeLists) == + sources.end()) { + sources.push_back(srcCMakeLists); + } +} + std::string GetSourcecodeValueFromFileExtension(const std::string& _ext, const std::string& lang, bool& keepLastKnownFileType) @@ -1063,10 +1076,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeTargets( } // Add CMakeLists.txt file for user convenience. - std::string listfile = - gtgt->GetLocalGenerator()->GetCurrentSourceDirectory(); - listfile += "/CMakeLists.txt"; - classes.push_back(gtgt->Makefile->GetOrCreateSource(listfile)); + this->AddXCodeProjBuildRule(gtgt, classes); std::sort(classes.begin(), classes.end(), cmSourceFilePathCompare()); @@ -2359,10 +2369,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateUtilityTarget( } // Add CMakeLists.txt file for user convenience. - std::string listfile = - gtgt->GetLocalGenerator()->GetCurrentSourceDirectory(); - listfile += "/CMakeLists.txt"; - sources.push_back(gtgt->Makefile->GetOrCreateSource(listfile)); + this->AddXCodeProjBuildRule(gtgt, sources); for (auto sourceFile : sources) { if (!sourceFile->GetPropertyAsBool("GENERATED")) { |