VS10: Define CMAKE_VS_PLATFORM_TOOLSET variable

When the VS 10 generator selects a non-default PlatformToolset to
specify for MSBuild, report the selected name in this variable.
This commit is contained in:
Brad King 2012-08-16 16:20:34 -04:00
parent 965a69dcaa
commit 89595d6bce
3 changed files with 22 additions and 0 deletions

View File

@ -282,6 +282,16 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"This variable is around for backwards compatibility, "
"see CMAKE_BUILD_TOOL.",false,
"Variables that Provide Information");
cm->DefineProperty
("CMAKE_VS_PLATFORM_TOOLSET", cmProperty::VARIABLE,
"Visual Studio Platform Toolset name.",
"VS 10 and above use MSBuild under the hood and support multiple "
"compiler toolchains. "
"CMake may specify a toolset explicitly, such as \"v110\" for "
"VS 11 or \"Windows7.1SDK\" for 64-bit support in VS 10 Express. "
"CMake provides the name of the chosen toolset in this variable."
,false,
"Variables that Provide Information");
cm->DefineProperty
("CMAKE_MINOR_VERSION", cmProperty::VARIABLE,
"The Minor version of cmake (i.e. the 4 in X.4.X).",

View File

@ -27,6 +27,17 @@ cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator()
"ProductDir", vc10Express, cmSystemTools::KeyWOW64_32);
}
//----------------------------------------------------------------------------
void cmGlobalVisualStudio10Generator::AddPlatformDefinitions(cmMakefile* mf)
{
cmGlobalVisualStudio8Generator::AddPlatformDefinitions(mf);
if(!this->PlatformToolset.empty())
{
mf->AddDefinition("CMAKE_VS_PLATFORM_TOOLSET",
this->PlatformToolset.c_str());
}
}
//----------------------------------------------------------------------------
void cmGlobalVisualStudio10Generator::WriteSLNHeader(std::ostream& fout)
{

View File

@ -38,6 +38,7 @@ public:
virtual const char* GetName() const {
return cmGlobalVisualStudio10Generator::GetActualName();}
static const char* GetActualName() {return "Visual Studio 10";}
virtual void AddPlatformDefinitions(cmMakefile* mf);
/** Get the documentation entry for this generator. */
virtual void GetDocumentation(cmDocumentationEntry& entry) const;