summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalXCodeGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-04-13 13:46:54 (GMT)
committerBrad King <brad.king@kitware.com>2018-04-13 13:46:54 (GMT)
commit0a122393d7cca291e2f695d85b3781593dbd4035 (patch)
tree501401b5d6324b1321b2d159fc9481dddabcad92 /Source/cmGlobalXCodeGenerator.cxx
parent07604a767ddb98b1020b546aa257bd7a965caf0a (diff)
parent8480c2afc09d3e976e4eff69081f41d812fb35cb (diff)
downloadCMake-0a122393d7cca291e2f695d85b3781593dbd4035.zip
CMake-0a122393d7cca291e2f695d85b3781593dbd4035.tar.gz
CMake-0a122393d7cca291e2f695d85b3781593dbd4035.tar.bz2
Merge branch 'backport-fix-explicit-CMakeLists.txt'
Diffstat (limited to 'Source/cmGlobalXCodeGenerator.cxx')
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx23
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")) {