diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-10-22 23:17:32 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-10-27 06:44:21 (GMT) |
commit | 00b8c0a8d4b59dc01276d083ccae4a8138718b12 (patch) | |
tree | bfff3d3098b9674d4e74829119d57c7ef4cfd86f /Source | |
parent | 4c6374bcc56ea7d7f7e67c518e60de94be267256 (diff) | |
download | CMake-00b8c0a8d4b59dc01276d083ccae4a8138718b12.zip CMake-00b8c0a8d4b59dc01276d083ccae4a8138718b12.tar.gz CMake-00b8c0a8d4b59dc01276d083ccae4a8138718b12.tar.bz2 |
cmLocalGenerator: Add IsRootMakefile API
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGlobalUnixMakefileGenerator3.cxx | 4 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 5 | ||||
-rw-r--r-- | Source/cmLocalGenerator.h | 2 | ||||
-rw-r--r-- | Source/cmLocalNinjaGenerator.cxx | 4 | ||||
-rw-r--r-- | Source/cmLocalUnixMakefileGenerator3.cxx | 6 |
5 files changed, 14 insertions, 7 deletions
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index b4a915c..7dd24fb 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -523,7 +523,7 @@ cmGlobalUnixMakefileGenerator3 cmLocalUnixMakefileGenerator3* lg) { // Only subdirectories need these rules. - if(lg->GetMakefile()->IsRootMakefile()) + if(lg->IsRootMakefile()) { return; } @@ -1084,7 +1084,7 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]); // for the passed in makefile or if this is the top Makefile wripte out // the targets - if (lg2 == lg || lg->GetMakefile()->IsRootMakefile()) + if (lg2 == lg || lg->IsRootMakefile()) { // for each target Generate the rule files for each target. std::vector<cmGeneratorTarget*> targets = lg2->GetGeneratorTargets(); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 5f0242e..1926772 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -490,6 +490,11 @@ void cmLocalGenerator::ComputeTargetManifest() } } +bool cmLocalGenerator::IsRootMakefile() const +{ + return !this->StateSnapshot.GetBuildsystemDirectoryParent().IsValid(); +} + cmState* cmLocalGenerator::GetState() const { return this->GlobalGenerator->GetCMakeInstance()->GetState(); diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 6380db6..46eb1b3 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -67,6 +67,8 @@ public: */ void ComputeTargetManifest(); + bool IsRootMakefile() const; + ///! Get the makefile for this generator cmMakefile *GetMakefile() { return this->Makefile; } diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 891c44e..7de48a4 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -56,7 +56,7 @@ void cmLocalNinjaGenerator::Generate() #endif // We do that only once for the top CMakeLists.txt file. - if(this->Makefile->IsRootMakefile()) + if(this->IsRootMakefile()) { this->WriteBuildFileTop(); @@ -277,7 +277,7 @@ void cmLocalNinjaGenerator::WriteProcessedMakefile(std::ostream& os) << "# Write statements declared in CMakeLists.txt:" << std::endl << "# " << this->Makefile->GetDefinition("CMAKE_CURRENT_LIST_FILE") << std::endl; - if(this->Makefile->IsRootMakefile()) + if(this->IsRootMakefile()) os << "# Which is the root file." << std::endl; cmGlobalNinjaGenerator::WriteDivider(os); os << std::endl; diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 9bb2765..82e3b01 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -254,7 +254,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile() return; } // always write the top makefile - if (!this->GetMakefile()->IsRootMakefile()) + if (!this->IsRootMakefile()) { ruleFileStream.SetCopyIfDifferent(true); } @@ -265,7 +265,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile() // only write local targets unless at the top Keep track of targets already // listed. std::set<std::string> emittedTargets; - if (!this->GetMakefile()->IsRootMakefile()) + if (!this->IsRootMakefile()) { // write our targets, and while doing it collect up the object // file rules @@ -880,7 +880,7 @@ void cmLocalUnixMakefileGenerator3 std::vector<std::string> no_depends; std::vector<std::string> commands; commands.push_back(runRule); - if(!this->GetMakefile()->IsRootMakefile()) + if(!this->IsRootMakefile()) { this->CreateCDCommand(commands, this->GetBinaryDirectory(), |