summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-05-27 13:23:01 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2015-05-27 13:23:01 (GMT)
commitc12fc3573bd86122279467e662b7ec58c72b5ffa (patch)
tree8587222d7561ad92d900b670b4a8adc72d683074 /Source/cmLocalGenerator.cxx
parent94e4b5d2c36e541919ebabb8c7f8cca5abf36a09 (diff)
parent3b880a07417a0211001b8dfa721ec220e6d8d2e3 (diff)
downloadCMake-c12fc3573bd86122279467e662b7ec58c72b5ffa.zip
CMake-c12fc3573bd86122279467e662b7ec58c72b5ffa.tar.gz
CMake-c12fc3573bd86122279467e662b7ec58c72b5ffa.tar.bz2
Merge topic 'inject-state-snapshot'
3b880a07 cmLocalGenerator: Require a valid cmState::Snapshot in the ctor. e12afe76 cmState: Host some state from the cmGlobalGenerator. c7b79aa1 cmGlobalGenerator: Require a cmake instance in ctor. 01e1cd5c cmState: Move snapshot creation to the cmake instance.
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r--Source/cmLocalGenerator.cxx45
1 files changed, 23 insertions, 22 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 41dc8c5..eb6b871 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -44,21 +44,18 @@
#endif
cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg,
- cmLocalGenerator* parent)
+ cmLocalGenerator* parent,
+ cmState::Snapshot snapshot)
+ : StateSnapshot(snapshot)
{
+ assert(snapshot.IsValid());
this->GlobalGenerator = gg;
this->Parent = parent;
if (parent)
{
parent->AddChild(this);
- this->StateSnapshot =
- this->GetState()->CreateSnapshot(parent->StateSnapshot);
- }
- else
- {
- this->StateSnapshot =
- this->GetState()->CreateSnapshot(cmState::Snapshot(this->GetState()));
}
+
this->Makefile = new cmMakefile(this);
this->LinkScriptShell = false;
@@ -84,11 +81,14 @@ class cmLocalGeneratorCurrent
{
cmGlobalGenerator* GG;
cmLocalGenerator* LG;
+ cmState::Snapshot Snapshot;
public:
cmLocalGeneratorCurrent(cmLocalGenerator* lg)
{
this->GG = lg->GetGlobalGenerator();
this->LG = this->GG->GetCurrentLocalGenerator();
+ this->Snapshot = this->GG->GetCMakeInstance()->GetCurrentSnapshot();
+ this->GG->GetCMakeInstance()->SetCurrentSnapshot(lg->GetStateSnapshot());
this->GG->SetCurrentLocalGenerator(lg);
#if defined(CMAKE_BUILD_WITH_CMAKE)
this->GG->GetFileLockPool().PushFileScope();
@@ -100,6 +100,7 @@ public:
this->GG->GetFileLockPool().PopFileScope();
#endif
this->GG->SetCurrentLocalGenerator(this->LG);
+ this->GG->GetCMakeInstance()->SetCurrentSnapshot(this->Snapshot);
}
};
@@ -1175,7 +1176,7 @@ cmLocalGenerator::ConvertToOutputForExistingCommon(const std::string& remote,
// If this is a windows shell, the result has a space, and the path
// already exists, we can use a short-path to reference it without a
// space.
- if(this->GlobalGenerator->WindowsShell && result.find(' ') != result.npos &&
+ if(this->GetState()->UseWindowsShell() && result.find(' ') != result.npos &&
cmSystemTools::FileExists(remote.c_str()))
{
std::string tmp;
@@ -2583,7 +2584,7 @@ void cmLocalGenerator::JoinDefines(const std::set<std::string>& defines,
{
// Append the definition with proper escaping.
std::string def = dflag;
- if(this->GlobalGenerator->WatcomWMake)
+ if(this->GetState()->UseWatcomWMake())
{
// The Watcom compiler does its own command line parsing instead
// of using the windows shell rules. Definitions are one of
@@ -2753,7 +2754,7 @@ std::string cmLocalGenerator::ConvertToOutputFormat(const std::string& source,
// For the MSYS shell convert drive letters to posix paths, so
// that c:/some/path becomes /c/some/path. This is needed to
// avoid problems with the shell path translation.
- if(this->GlobalGenerator->MSYSShell && !this->LinkScriptShell)
+ if(this->GetState()->UseMSYSShell() && !this->LinkScriptShell)
{
if(result.size() > 2 && result[1] == ':')
{
@@ -2761,7 +2762,7 @@ std::string cmLocalGenerator::ConvertToOutputFormat(const std::string& source,
result[0] = '/';
}
}
- if(this->GlobalGenerator->WindowsShell)
+ if(this->GetState()->UseWindowsShell())
{
std::replace(result.begin(), result.end(), '/', '\\');
}
@@ -3176,22 +3177,22 @@ void cmLocalGenerator::ComputeObjectFilenames(
bool cmLocalGenerator::IsWindowsShell() const
{
- return this->GlobalGenerator->WindowsShell;
+ return this->GetState()->UseWindowsShell();
}
bool cmLocalGenerator::IsWatcomWMake() const
{
- return this->GlobalGenerator->WatcomWMake;
+ return this->GetState()->UseWatcomWMake();
}
bool cmLocalGenerator::IsMinGWMake() const
{
- return this->GlobalGenerator->MinGWMake;
+ return this->GetState()->UseMinGWMake();
}
bool cmLocalGenerator::IsNMake() const
{
- return this->GlobalGenerator->NMake;
+ return this->GetState()->UseNMake();
}
void cmLocalGenerator::SetConfiguredCMP0014(bool configured)
@@ -3342,7 +3343,7 @@ std::string cmLocalGenerator::EscapeForShell(const std::string& str,
// Compute the flags for the target shell environment.
int flags = 0;
- if(this->GlobalGenerator->WindowsVSIDE)
+ if(this->GetState()->UseWindowsVSIDE())
{
flags |= cmsysSystem_Shell_Flag_VSIDE;
}
@@ -3362,27 +3363,27 @@ std::string cmLocalGenerator::EscapeForShell(const std::string& str,
{
flags |= cmsysSystem_Shell_Flag_WatcomQuote;
}
- if(this->GlobalGenerator->WatcomWMake)
+ if(this->GetState()->UseWatcomWMake())
{
flags |= cmsysSystem_Shell_Flag_WatcomWMake;
}
- if(this->GlobalGenerator->MinGWMake)
+ if(this->GetState()->UseMinGWMake())
{
flags |= cmsysSystem_Shell_Flag_MinGWMake;
}
- if(this->GlobalGenerator->NMake)
+ if(this->GetState()->UseNMake())
{
flags |= cmsysSystem_Shell_Flag_NMake;
}
// Compute the buffer size needed.
- int size = (this->GlobalGenerator->WindowsShell ?
+ int size = (this->GetState()->UseWindowsShell() ?
cmsysSystem_Shell_GetArgumentSizeForWindows(str.c_str(), flags) :
cmsysSystem_Shell_GetArgumentSizeForUnix(str.c_str(), flags));
// Compute the shell argument itself.
std::vector<char> arg(size);
- if(this->GlobalGenerator->WindowsShell)
+ if(this->GetState()->UseWindowsShell())
{
cmsysSystem_Shell_GetArgumentForWindows(str.c_str(), &arg[0], flags);
}