From 68f791cd06983e8fd375edfba74a9d821231e269 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 18 Apr 2015 14:50:31 +0200 Subject: cmMakefile: Add a method for processing buildsystem files. These are different from other ListFiles in that a project() command is required if it is top-level. --- Source/cmLocalGenerator.cxx | 2 +- Source/cmMakefile.cxx | 24 ++++++++---------------- Source/cmMakefile.h | 5 ++++- 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index c143bce..56e17ec 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -181,7 +181,7 @@ void cmLocalGenerator::ReadInputFile() currentStart += "/CMakeLists.txt"; if(cmSystemTools::FileExists(currentStart.c_str(), true)) { - this->Makefile->ReadListFile(currentStart.c_str()); + this->Makefile->ProcessBuildsystemFile(currentStart.c_str()); return; } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 8bc4ac8..b08725e 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -522,12 +522,19 @@ void cmMakefile::IncludeScope::EnforceCMP0011() } } +bool cmMakefile::ProcessBuildsystemFile(const char* listfile) +{ + return this->ReadListFile(listfile, 0, true, + this->cmStartDirectory == this->cmHomeDirectory); +} + //---------------------------------------------------------------------------- // Parse the given CMakeLists.txt file executing all commands // bool cmMakefile::ReadListFile(const char* filename_in, const char *external_in, - bool noPolicyScope) + bool noPolicyScope, + bool requireProjectCommand) { std::string currentParentFile = this->GetSafeDefinition("CMAKE_PARENT_LIST_FILE"); @@ -580,21 +587,6 @@ bool cmMakefile::ReadListFile(const char* filename_in, cmSystemTools::GetFilenamePath(filenametoread).c_str()); this->MarkVariableAsUsed("CMAKE_CURRENT_LIST_DIR"); - // try to see if the list file is the top most - // list file for a project, and if it is, then it - // must have a project command. If there is not - // one, then cmake will provide one via the - // cmListFileCache class. - bool requireProjectCommand = false; - if(!external && this->cmStartDirectory == this->cmHomeDirectory) - { - if(cmSystemTools::LowerCase( - cmSystemTools::GetFilenameName(filename)) == "cmakelists.txt") - { - requireProjectCommand = true; - } - } - // push the listfile onto the stack this->ListFileStack.push_back(filenametoread); cmListFile cacheFile; diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index ce21c60..33c4b20 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -87,7 +87,10 @@ public: */ bool ReadListFile(const char* listfile, const char* external= 0, - bool noPolicyScope = true); + bool noPolicyScope = true, + bool requireProjectCommand = false); + + bool ProcessBuildsystemFile(const char* listfile); /** * Add a function blocker to this makefile -- cgit v0.12