VS: Save WindowsPhone and WindowsStore system internally

Add boolean members to the VS >= 10 global generator to save
whether CMAKE_SYSTEM_NAME is WindowsPhone or WindowsStore
without having to repeat a string comparison.

Inspired-by: Gilles Khouzam <gillesk@microsoft.com>
This commit is contained in:
Brad King 2014-07-29 11:42:30 -04:00
parent c1580a9217
commit 3abd150ce9
2 changed files with 20 additions and 0 deletions

View File

@ -97,6 +97,8 @@ cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator(
this->ExpressEdition = cmSystemTools::ReadRegistryValue( this->ExpressEdition = cmSystemTools::ReadRegistryValue(
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\10.0\\Setup\\VC;" "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\10.0\\Setup\\VC;"
"ProductDir", vc10Express, cmSystemTools::KeyWOW64_32); "ProductDir", vc10Express, cmSystemTools::KeyWOW64_32);
this->SystemIsWindowsPhone = false;
this->SystemIsWindowsStore = false;
this->MasmEnabled = false; this->MasmEnabled = false;
this->MSBuildCommandInitialized = false; this->MSBuildCommandInitialized = false;
} }
@ -148,6 +150,14 @@ bool cmGlobalVisualStudio10Generator::SetSystemName(std::string const& s,
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool cmGlobalVisualStudio10Generator::InitializeSystem(cmMakefile*) bool cmGlobalVisualStudio10Generator::InitializeSystem(cmMakefile*)
{ {
if(this->SystemName == "WindowsPhone")
{
this->SystemIsWindowsPhone = true;
}
else if(this->SystemName == "WindowsStore")
{
this->SystemIsWindowsStore = true;
}
return true; return true;
} }

View File

@ -70,6 +70,14 @@ public:
/** Return the CMAKE_SYSTEM_VERSION. */ /** Return the CMAKE_SYSTEM_VERSION. */
std::string const& GetSystemVersion() const { return this->SystemVersion; } std::string const& GetSystemVersion() const { return this->SystemVersion; }
/** Return true if building for WindowsPhone */
bool TargetsWindowsPhone() const
{ return this->SystemIsWindowsPhone; }
/** Return true if building for WindowsStore */
bool TargetsWindowsStore() const
{ return this->SystemIsWindowsStore; }
/** /**
* Where does this version of Visual Studio look for macros for the * Where does this version of Visual Studio look for macros for the
* current user? Returns the empty string if this version of Visual * current user? Returns the empty string if this version of Visual
@ -108,6 +116,8 @@ protected:
std::string DefaultPlatformToolset; std::string DefaultPlatformToolset;
std::string SystemName; std::string SystemName;
std::string SystemVersion; std::string SystemVersion;
bool SystemIsWindowsPhone;
bool SystemIsWindowsStore;
bool ExpressEdition; bool ExpressEdition;
bool MasmEnabled; bool MasmEnabled;