diff options
Diffstat (limited to 'Source/cmLocalNinjaGenerator.cxx')
| -rw-r--r-- | Source/cmLocalNinjaGenerator.cxx | 57 |
1 files changed, 21 insertions, 36 deletions
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 640c1b3..4db36fc 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -18,17 +18,17 @@ #include "cmGeneratedFileStream.h" #include "cmSourceFile.h" #include "cmake.h" +#include "cmState.h" #include <assert.h> -cmLocalNinjaGenerator::cmLocalNinjaGenerator() - : cmLocalGenerator() +cmLocalNinjaGenerator::cmLocalNinjaGenerator(cmGlobalGenerator* gg, + cmLocalGenerator* parent, + cmState::Snapshot snapshot) + : cmLocalGenerator(gg, parent, snapshot) , ConfigName("") , HomeRelativeOutputPath("") { -#ifdef _WIN32 - this->WindowsShell = true; -#endif this->TargetImplib = "$TARGET_IMPLIB"; } @@ -41,6 +41,15 @@ cmLocalNinjaGenerator::~cmLocalNinjaGenerator() void cmLocalNinjaGenerator::Generate() { + // Compute the path to use when referencing the current output + // directory from the top output directory. + this->HomeRelativeOutputPath = + this->Convert(this->Makefile->GetCurrentBinaryDirectory(), HOME_OUTPUT); + if(this->HomeRelativeOutputPath == ".") + { + this->HomeRelativeOutputPath = ""; + } + this->SetConfigName(); this->WriteProcessedMakefile(this->GetBuildFileStream()); @@ -49,7 +58,7 @@ void cmLocalNinjaGenerator::Generate() #endif // We do that only once for the top CMakeLists.txt file. - if(this->isRootMakefile()) + if(this->Makefile->IsRootMakefile()) { this->WriteBuildFileTop(); @@ -91,25 +100,6 @@ void cmLocalNinjaGenerator::Generate() this->WriteCustomCommandBuildStatements(); } -// Implemented in: -// cmLocalUnixMakefileGenerator3. -// Used in: -// Source/cmMakefile.cxx -// Source/cmGlobalGenerator.cxx -void cmLocalNinjaGenerator::Configure() -{ - // Compute the path to use when referencing the current output - // directory from the top output directory. - this->HomeRelativeOutputPath = - this->Convert(this->Makefile->GetStartOutputDirectory(), HOME_OUTPUT); - if(this->HomeRelativeOutputPath == ".") - { - this->HomeRelativeOutputPath = ""; - } - this->cmLocalGenerator::Configure(); - -} - // TODO: Picked up from cmLocalUnixMakefileGenerator3. Refactor it. std::string cmLocalNinjaGenerator ::GetTargetDirectory(cmTarget const& target) const @@ -180,11 +170,6 @@ cmake* cmLocalNinjaGenerator::GetCMakeInstance() return this->GetGlobalGenerator()->GetCMakeInstance(); } -bool cmLocalNinjaGenerator::isRootMakefile() const -{ - return !this->GetParent(); -} - void cmLocalNinjaGenerator::WriteBuildFileTop() { // For the build file. @@ -234,8 +219,8 @@ void cmLocalNinjaGenerator::WritePools(std::ostream& os) { cmGlobalNinjaGenerator::WriteDivider(os); - const char* jobpools = this->GetCMakeInstance() - ->GetProperty("JOB_POOLS", cmProperty::GLOBAL); + const char* jobpools = this->GetCMakeInstance()->GetState() + ->GetGlobalProperty("JOB_POOLS"); if (jobpools) { cmGlobalNinjaGenerator::WriteComment(os, @@ -311,9 +296,9 @@ void cmLocalNinjaGenerator::WriteProcessedMakefile(std::ostream& os) cmGlobalNinjaGenerator::WriteDivider(os); os << "# Write statements declared in CMakeLists.txt:" << std::endl - << "# " << this->Makefile->GetCurrentListFile() << std::endl - ; - if(this->isRootMakefile()) + << "# " + << this->Makefile->GetDefinition("CMAKE_CURRENT_LIST_FILE") << std::endl; + if(this->Makefile->IsRootMakefile()) os << "# Which is the root file." << std::endl; cmGlobalNinjaGenerator::WriteDivider(os); os << std::endl; @@ -406,7 +391,7 @@ void cmLocalNinjaGenerator::AppendCustomCommandLines( if (ccg.GetNumberOfCommands() > 0) { std::string wd = ccg.GetWorkingDirectory(); if (wd.empty()) - wd = this->GetMakefile()->GetStartOutputDirectory(); + wd = this->GetMakefile()->GetCurrentBinaryDirectory(); std::ostringstream cdCmd; #ifdef _WIN32 |
