summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-05-24 11:46:30 +0200
committerBrad King <brad.king@kitware.com>2015-05-27 09:18:31 -0400
commite12afe766ee9083637ac819ec69a7b4512c39718 (patch)
tree85db9cc4b3a6e0815d75423956f4f959de13f931
parentc7b79aa16adc1117e62bf146c64f97c992ec2e2e (diff)
downloadcmake-e12afe766ee9083637ac819ec69a7b4512c39718.tar.gz
cmState: Host some state from the cmGlobalGenerator.
-rw-r--r--Source/cmGlobalBorlandMakefileGenerator.cxx2
-rw-r--r--Source/cmGlobalGenerator.cxx7
-rw-r--r--Source/cmGlobalGenerator.h7
-rw-r--r--Source/cmGlobalJOMMakefileGenerator.cxx4
-rw-r--r--Source/cmGlobalMSYSMakefileGenerator.cxx2
-rw-r--r--Source/cmGlobalMinGWMakefileGenerator.cxx4
-rw-r--r--Source/cmGlobalNMakeMakefileGenerator.cxx4
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx2
-rw-r--r--Source/cmGlobalVisualStudioGenerator.cxx4
-rw-r--r--Source/cmGlobalWatcomWMakeGenerator.cxx4
-rw-r--r--Source/cmLocalGenerator.cxx28
-rw-r--r--Source/cmState.cxx68
-rw-r--r--Source/cmState.h19
13 files changed, 113 insertions, 42 deletions
diff --git a/Source/cmGlobalBorlandMakefileGenerator.cxx b/Source/cmGlobalBorlandMakefileGenerator.cxx
index 5e0f3935bc..7d05726775 100644
--- a/Source/cmGlobalBorlandMakefileGenerator.cxx
+++ b/Source/cmGlobalBorlandMakefileGenerator.cxx
@@ -22,7 +22,7 @@ cmGlobalBorlandMakefileGenerator::cmGlobalBorlandMakefileGenerator(cmake* cm)
this->ForceUnixPaths = false;
this->ToolSupportsColor = true;
this->UseLinkScript = false;
- this->WindowsShell = true;
+ cm->GetState()->SetWindowsShell(true);
this->IncludeDirective = "!include";
this->DefineWindowsNULL = true;
this->PassMakeflags = true;
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 64cd1de23d..7cb572477c 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -72,13 +72,6 @@ cmGlobalGenerator::cmGlobalGenerator(cmake* cm)
this->ExtraGenerator = 0;
this->CurrentLocalGenerator = 0;
this->TryCompileOuterMakefile = 0;
-
- this->WindowsShell = false;
- this->WindowsVSIDE = false;
- this->WatcomWMake = false;
- this->MinGWMake = false;
- this->NMake = false;
- this->MSYSShell = false;
}
cmGlobalGenerator::~cmGlobalGenerator()
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index a76cfcb059..98f87ed957 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -355,13 +355,6 @@ public:
#endif
std::string MakeSilentFlag;
- bool WindowsShell;
- bool WindowsVSIDE;
- bool WatcomWMake;
- bool MinGWMake;
- bool NMake;
- bool MSYSShell;
-
protected:
virtual void Generate();
diff --git a/Source/cmGlobalJOMMakefileGenerator.cxx b/Source/cmGlobalJOMMakefileGenerator.cxx
index e0e07c1c12..50e70531d5 100644
--- a/Source/cmGlobalJOMMakefileGenerator.cxx
+++ b/Source/cmGlobalJOMMakefileGenerator.cxx
@@ -20,8 +20,8 @@ cmGlobalJOMMakefileGenerator::cmGlobalJOMMakefileGenerator(cmake* cm)
this->ForceUnixPaths = false;
this->ToolSupportsColor = true;
this->UseLinkScript = false;
- this->WindowsShell = true;
- this->NMake = true;
+ cm->GetState()->SetWindowsShell(true);
+ cm->GetState()->SetNMake(true);
this->DefineWindowsNULL = true;
this->PassMakeflags = true;
this->UnixCD = false;
diff --git a/Source/cmGlobalMSYSMakefileGenerator.cxx b/Source/cmGlobalMSYSMakefileGenerator.cxx
index 750fa5fc39..a84923b1b2 100644
--- a/Source/cmGlobalMSYSMakefileGenerator.cxx
+++ b/Source/cmGlobalMSYSMakefileGenerator.cxx
@@ -22,7 +22,7 @@ cmGlobalMSYSMakefileGenerator::cmGlobalMSYSMakefileGenerator(cmake* cm)
this->ForceUnixPaths = true;
this->ToolSupportsColor = true;
this->UseLinkScript = false;
- this->MSYSShell = true;
+ cm->GetState()->SetMSYSShell(true);
}
std::string
diff --git a/Source/cmGlobalMinGWMakefileGenerator.cxx b/Source/cmGlobalMinGWMakefileGenerator.cxx
index 999db84fa2..b6e52d7bc8 100644
--- a/Source/cmGlobalMinGWMakefileGenerator.cxx
+++ b/Source/cmGlobalMinGWMakefileGenerator.cxx
@@ -20,8 +20,8 @@ cmGlobalMinGWMakefileGenerator::cmGlobalMinGWMakefileGenerator(cmake* cm)
this->ForceUnixPaths = true;
this->ToolSupportsColor = true;
this->UseLinkScript = true;
- this->WindowsShell = true;
- this->MinGWMake = true;
+ cm->GetState()->SetWindowsShell(true);
+ cm->GetState()->SetMinGWMake(true);
}
void cmGlobalMinGWMakefileGenerator
diff --git a/Source/cmGlobalNMakeMakefileGenerator.cxx b/Source/cmGlobalNMakeMakefileGenerator.cxx
index 8f8d64e09f..4219c34042 100644
--- a/Source/cmGlobalNMakeMakefileGenerator.cxx
+++ b/Source/cmGlobalNMakeMakefileGenerator.cxx
@@ -20,8 +20,8 @@ cmGlobalNMakeMakefileGenerator::cmGlobalNMakeMakefileGenerator(cmake* cm)
this->ForceUnixPaths = false;
this->ToolSupportsColor = true;
this->UseLinkScript = false;
- this->WindowsShell = true;
- this->NMake = true;
+ cm->GetState()->SetWindowsShell(true);
+ cm->GetState()->SetNMake(true);
this->DefineWindowsNULL = true;
this->PassMakeflags = true;
this->UnixCD = false;
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 86938bda69..2c5896ce36 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -517,7 +517,7 @@ cmGlobalNinjaGenerator::cmGlobalNinjaGenerator(cmake* cm)
, PolicyCMP0058(cmPolicies::WARN)
{
#ifdef _WIN32
- this->WindowsShell = true;
+ cm->GetState()->SetWindowsShell(true);
#endif
// // Ninja is not ported to non-Unix OS yet.
// this->ForceUnixPaths = true;
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index 1cf990f9e7..585d19a816 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -24,8 +24,8 @@
cmGlobalVisualStudioGenerator::cmGlobalVisualStudioGenerator(cmake* cm)
: cmGlobalGenerator(cm)
{
- this->WindowsShell = true;
- this->WindowsVSIDE = true;
+ cm->GetState()->SetWindowsShell(true);
+ cm->GetState()->SetWindowsVSIDE(true);
}
//----------------------------------------------------------------------------
diff --git a/Source/cmGlobalWatcomWMakeGenerator.cxx b/Source/cmGlobalWatcomWMakeGenerator.cxx
index e76d783c23..153773fcb2 100644
--- a/Source/cmGlobalWatcomWMakeGenerator.cxx
+++ b/Source/cmGlobalWatcomWMakeGenerator.cxx
@@ -24,9 +24,9 @@ cmGlobalWatcomWMakeGenerator::cmGlobalWatcomWMakeGenerator(cmake* cm)
this->NeedSymbolicMark = true;
this->EmptyRuleHackCommand = "@cd .";
#ifdef _WIN32
- this->WindowsShell = true;
+ cm->GetState()->SetWindowsShell(true);
#endif
- this->WatcomWMake = true;
+ cm->GetState()->SetWatcomWMake(true);
this->IncludeDirective = "!include";
this->DefineWindowsNULL = true;
this->UnixCD = false;
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 442b9bfe00..d00b677daa 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1179,7 +1179,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;
@@ -2551,7 +2551,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
@@ -2721,7 +2721,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] == ':')
{
@@ -2729,7 +2729,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(), '/', '\\');
}
@@ -3144,22 +3144,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)
@@ -3310,7 +3310,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;
}
@@ -3330,27 +3330,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);
}
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index 389a316d3c..9ecd061edb 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -20,7 +20,13 @@
cmState::cmState(cmake* cm)
: CMakeInstance(cm),
- IsInTryCompile(false)
+ IsInTryCompile(false),
+ WindowsShell(false),
+ WindowsVSIDE(false),
+ WatcomWMake(false),
+ MinGWMake(false),
+ NMake(false),
+ MSYSShell(false)
{
}
@@ -503,6 +509,66 @@ void cmState::SetBinaryDirectory(std::string const& binaryDirectory)
this->BinaryDirectoryComponents);
}
+void cmState::SetWindowsShell(bool windowsShell)
+{
+ this->WindowsShell = windowsShell;
+}
+
+bool cmState::UseWindowsShell() const
+{
+ return this->WindowsShell;
+}
+
+void cmState::SetWindowsVSIDE(bool windowsVSIDE)
+{
+ this->WindowsVSIDE = windowsVSIDE;
+}
+
+bool cmState::UseWindowsVSIDE() const
+{
+ return this->WindowsVSIDE;
+}
+
+void cmState::SetWatcomWMake(bool watcomWMake)
+{
+ this->WatcomWMake = watcomWMake;
+}
+
+bool cmState::UseWatcomWMake() const
+{
+ return this->WatcomWMake;
+}
+
+void cmState::SetMinGWMake(bool minGWMake)
+{
+ this->MinGWMake = minGWMake;
+}
+
+bool cmState::UseMinGWMake() const
+{
+ return this->MinGWMake;
+}
+
+void cmState::SetNMake(bool nMake)
+{
+ this->NMake = nMake;
+}
+
+bool cmState::UseNMake() const
+{
+ return this->NMake;
+}
+
+void cmState::SetMSYSShell(bool mSYSShell)
+{
+ this->MSYSShell = mSYSShell;
+}
+
+bool cmState::UseMSYSShell() const
+{
+ return this->MSYSShell;
+}
+
const char* cmState::GetBinaryDirectory() const
{
return this->BinaryDirectory.c_str();
diff --git a/Source/cmState.h b/Source/cmState.h
index 424fe4547c..77a066f9fe 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -138,6 +138,19 @@ public:
std::vector<std::string> const& GetSourceDirectoryComponents() const;
std::vector<std::string> const& GetBinaryDirectoryComponents() const;
+ void SetWindowsShell(bool windowsShell);
+ bool UseWindowsShell() const;
+ void SetWindowsVSIDE(bool windowsVSIDE);
+ bool UseWindowsVSIDE() const;
+ void SetWatcomWMake(bool watcomWMake);
+ bool UseWatcomWMake() const;
+ void SetMinGWMake(bool minGWMake);
+ bool UseMinGWMake() const;
+ void SetNMake(bool nMake);
+ bool UseNMake() const;
+ void SetMSYSShell(bool mSYSShell);
+ bool UseMSYSShell() const;
+
private:
std::map<cmProperty::ScopeType, cmPropertyDefinitionMap> PropertyDefinitions;
std::vector<std::string> EnabledLanguages;
@@ -163,6 +176,12 @@ private:
std::string SourceDirectory;
std::string BinaryDirectory;
bool IsInTryCompile;
+ bool WindowsShell;
+ bool WindowsVSIDE;
+ bool WatcomWMake;
+ bool MinGWMake;
+ bool NMake;
+ bool MSYSShell;
};
#endif