diff options
author | Brad King <brad.king@kitware.com> | 2016-06-16 14:54:20 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-06-17 18:22:28 (GMT) |
commit | 0392f72bef5f1394c2dba3740f2a701fe1a98f0d (patch) | |
tree | 5bb6a79a0a64bce356ef4f7a6d0c7df4b0e474e7 | |
parent | 9e4725560493fdac423102469da6dbe1779383c4 (diff) | |
download | CMake-0392f72bef5f1394c2dba3740f2a701fe1a98f0d.zip CMake-0392f72bef5f1394c2dba3740f2a701fe1a98f0d.tar.gz CMake-0392f72bef5f1394c2dba3740f2a701fe1a98f0d.tar.bz2 |
Refactor Makefile/Ninja tool working directory storage
Move cmCommonTargetGenerator::WorkingDirectory to cmLocalCommonGenerator
and add an access method.
-rw-r--r-- | Source/cmCommonTargetGenerator.cxx | 12 | ||||
-rw-r--r-- | Source/cmCommonTargetGenerator.h | 4 | ||||
-rw-r--r-- | Source/cmLocalCommonGenerator.cxx | 5 | ||||
-rw-r--r-- | Source/cmLocalCommonGenerator.h | 10 | ||||
-rw-r--r-- | Source/cmLocalNinjaGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmLocalUnixMakefileGenerator3.cxx | 2 | ||||
-rw-r--r-- | Source/cmMakefileTargetGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmNinjaTargetGenerator.cxx | 2 |
8 files changed, 23 insertions, 16 deletions
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index b893dd3..1cc04ea 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -19,10 +19,8 @@ #include "cmSourceFile.h" #include "cmSystemTools.h" -cmCommonTargetGenerator::cmCommonTargetGenerator( - cmOutputConverter::RelativeRoot wd, cmGeneratorTarget* gt) - : WorkingDirectory(wd) - , GeneratorTarget(gt) +cmCommonTargetGenerator::cmCommonTargetGenerator(cmGeneratorTarget* gt) + : GeneratorTarget(gt) , Makefile(gt->Makefile) , LocalGenerator(static_cast<cmLocalCommonGenerator*>(gt->LocalGenerator)) , GlobalGenerator(static_cast<cmGlobalCommonGenerator*>( @@ -140,7 +138,8 @@ void cmCommonTargetGenerator::AddFortranFlags(std::string& flags) std::string mod_dir = this->GetFortranModuleDirectory(); if (!mod_dir.empty()) { mod_dir = - this->Convert(mod_dir, this->WorkingDirectory, cmOutputConverter::SHELL); + this->Convert(mod_dir, this->LocalGenerator->GetWorkingDirectory(), + cmOutputConverter::SHELL); } else { mod_dir = this->Makefile->GetSafeDefinition("CMAKE_Fortran_MODDIR_DEFAULT"); @@ -308,7 +307,8 @@ std::string cmCommonTargetGenerator::GetManifests() for (std::vector<cmSourceFile const*>::iterator mi = manifest_srcs.begin(); mi != manifest_srcs.end(); ++mi) { manifests.push_back(this->Convert( - (*mi)->GetFullPath(), this->WorkingDirectory, cmOutputConverter::SHELL)); + (*mi)->GetFullPath(), this->LocalGenerator->GetWorkingDirectory(), + cmOutputConverter::SHELL)); } return cmJoin(manifests, " "); diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h index ace5351..c35d22a 100644 --- a/Source/cmCommonTargetGenerator.h +++ b/Source/cmCommonTargetGenerator.h @@ -28,8 +28,7 @@ class cmSourceFile; class cmCommonTargetGenerator { public: - cmCommonTargetGenerator(cmOutputConverter::RelativeRoot wd, - cmGeneratorTarget* gt); + cmCommonTargetGenerator(cmGeneratorTarget* gt); virtual ~cmCommonTargetGenerator(); std::string const& GetConfigName() const; @@ -45,7 +44,6 @@ protected: // Helper to add flag for windows .def file. void AddModuleDefinitionFlag(std::string& flags); - cmOutputConverter::RelativeRoot WorkingDirectory; cmGeneratorTarget* GeneratorTarget; cmMakefile* Makefile; cmLocalCommonGenerator* LocalGenerator; diff --git a/Source/cmLocalCommonGenerator.cxx b/Source/cmLocalCommonGenerator.cxx index 3ebd128..6cfeb10 100644 --- a/Source/cmLocalCommonGenerator.cxx +++ b/Source/cmLocalCommonGenerator.cxx @@ -13,9 +13,10 @@ #include "cmMakefile.h" -cmLocalCommonGenerator::cmLocalCommonGenerator(cmGlobalGenerator* gg, - cmMakefile* mf) +cmLocalCommonGenerator::cmLocalCommonGenerator( + cmGlobalGenerator* gg, cmMakefile* mf, cmOutputConverter::RelativeRoot wd) : cmLocalGenerator(gg, mf) + , WorkingDirectory(wd) { } diff --git a/Source/cmLocalCommonGenerator.h b/Source/cmLocalCommonGenerator.h index d282054..10380db 100644 --- a/Source/cmLocalCommonGenerator.h +++ b/Source/cmLocalCommonGenerator.h @@ -22,12 +22,20 @@ class cmCommonTargetGenerator; class cmLocalCommonGenerator : public cmLocalGenerator { public: - cmLocalCommonGenerator(cmGlobalGenerator* gg, cmMakefile* mf); + cmLocalCommonGenerator(cmGlobalGenerator* gg, cmMakefile* mf, + cmOutputConverter::RelativeRoot wd); ~cmLocalCommonGenerator(); std::string const& GetConfigName() { return this->ConfigName; } + cmOutputConverter::RelativeRoot GetWorkingDirectory() const + { + return this->WorkingDirectory; + } + protected: + cmOutputConverter::RelativeRoot WorkingDirectory; + void SetConfigName(); std::string ConfigName; diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 6e676f1..0f488a6 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -25,7 +25,7 @@ cmLocalNinjaGenerator::cmLocalNinjaGenerator(cmGlobalGenerator* gg, cmMakefile* mf) - : cmLocalCommonGenerator(gg, mf) + : cmLocalCommonGenerator(gg, mf, cmOutputConverter::HOME_OUTPUT) , HomeRelativeOutputPath("") { this->TargetImplib = "$TARGET_IMPLIB"; diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 4b5af8b..460f0e2 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -84,7 +84,7 @@ static std::string cmSplitExtension(std::string const& in, std::string& base) cmLocalUnixMakefileGenerator3::cmLocalUnixMakefileGenerator3( cmGlobalGenerator* gg, cmMakefile* mf) - : cmLocalCommonGenerator(gg, mf) + : cmLocalCommonGenerator(gg, mf, cmOutputConverter::START_OUTPUT) { this->MakefileVariableSize = 0; this->ColorMakefile = false; diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 3086bb1..daf05d3 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -32,7 +32,7 @@ #include <ctype.h> cmMakefileTargetGenerator::cmMakefileTargetGenerator(cmGeneratorTarget* target) - : cmCommonTargetGenerator(cmOutputConverter::START_OUTPUT, target) + : cmCommonTargetGenerator(target) , OSXBundleGenerator(0) , MacOSXContentGenerator(0) { diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 05a0a63..b413c33 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -58,7 +58,7 @@ cmNinjaTargetGenerator* cmNinjaTargetGenerator::New(cmGeneratorTarget* target) } cmNinjaTargetGenerator::cmNinjaTargetGenerator(cmGeneratorTarget* target) - : cmCommonTargetGenerator(cmOutputConverter::HOME_OUTPUT, target) + : cmCommonTargetGenerator(target) , MacOSXContentGenerator(0) , OSXBundleGenerator(0) , MacContentFolders() |