VS: Split user- and generator-provided PlatformToolset
Divide the cmGlobalVisualStudio10Generator "PlatformToolset" member into two members representing the generator-selected default toolset and the user-specified CMAKE_GENERATOR_TOOLSET value. Prefer the user-specified value, if any, and then fall back to the generator-selected default.
This commit is contained in:
parent
3e9f6e36f3
commit
98afb4549f
|
@ -118,7 +118,7 @@ cmGlobalVisualStudio10Generator::MatchesGeneratorName(
|
||||||
bool
|
bool
|
||||||
cmGlobalVisualStudio10Generator::SetGeneratorToolset(std::string const& ts)
|
cmGlobalVisualStudio10Generator::SetGeneratorToolset(std::string const& ts)
|
||||||
{
|
{
|
||||||
this->PlatformToolset = ts;
|
this->GeneratorToolset = ts;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,10 +126,16 @@ cmGlobalVisualStudio10Generator::SetGeneratorToolset(std::string const& ts)
|
||||||
void cmGlobalVisualStudio10Generator::AddPlatformDefinitions(cmMakefile* mf)
|
void cmGlobalVisualStudio10Generator::AddPlatformDefinitions(cmMakefile* mf)
|
||||||
{
|
{
|
||||||
cmGlobalVisualStudio8Generator::AddPlatformDefinitions(mf);
|
cmGlobalVisualStudio8Generator::AddPlatformDefinitions(mf);
|
||||||
if(!this->PlatformToolset.empty())
|
this->AddVSPlatformToolsetDefinition(mf);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void cmGlobalVisualStudio10Generator
|
||||||
|
::AddVSPlatformToolsetDefinition(cmMakefile* mf) const
|
||||||
|
{
|
||||||
|
if(const char* toolset = this->GetPlatformToolset())
|
||||||
{
|
{
|
||||||
mf->AddDefinition("CMAKE_VS_PLATFORM_TOOLSET",
|
mf->AddDefinition("CMAKE_VS_PLATFORM_TOOLSET", toolset);
|
||||||
this->PlatformToolset.c_str());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,11 +221,15 @@ void cmGlobalVisualStudio10Generator
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
const char* cmGlobalVisualStudio10Generator::GetPlatformToolset()
|
const char* cmGlobalVisualStudio10Generator::GetPlatformToolset() const
|
||||||
{
|
{
|
||||||
if(!this->PlatformToolset.empty())
|
if(!this->GeneratorToolset.empty())
|
||||||
{
|
{
|
||||||
return this->PlatformToolset.c_str();
|
return this->GeneratorToolset.c_str();
|
||||||
|
}
|
||||||
|
if(!this->DefaultPlatformToolset.empty())
|
||||||
|
{
|
||||||
|
return this->DefaultPlatformToolset.c_str();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -417,7 +427,7 @@ void cmGlobalVisualStudio10Generator::GenerateBuildCommand(
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
bool cmGlobalVisualStudio10Generator::Find64BitTools(cmMakefile* mf)
|
bool cmGlobalVisualStudio10Generator::Find64BitTools(cmMakefile* mf)
|
||||||
{
|
{
|
||||||
if(!this->PlatformToolset.empty())
|
if(this->GetPlatformToolset())
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -435,7 +445,7 @@ bool cmGlobalVisualStudio10Generator::Find64BitTools(cmMakefile* mf)
|
||||||
cmOStringStream m;
|
cmOStringStream m;
|
||||||
m << "Found Windows SDK v7.1: " << winSDK_7_1;
|
m << "Found Windows SDK v7.1: " << winSDK_7_1;
|
||||||
mf->DisplayStatus(m.str().c_str(), -1);
|
mf->DisplayStatus(m.str().c_str(), -1);
|
||||||
this->PlatformToolset = "Windows7.1SDK";
|
this->DefaultPlatformToolset = "Windows7.1SDK";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -66,7 +66,7 @@ public:
|
||||||
bool IsMasmEnabled() const { return this->MasmEnabled; }
|
bool IsMasmEnabled() const { return this->MasmEnabled; }
|
||||||
|
|
||||||
/** The toolset name for the target platform. */
|
/** The toolset name for the target platform. */
|
||||||
const char* GetPlatformToolset();
|
const char* GetPlatformToolset() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Where does this version of Visual Studio look for macros for the
|
* Where does this version of Visual Studio look for macros for the
|
||||||
|
@ -99,7 +99,8 @@ protected:
|
||||||
|
|
||||||
std::string const& GetMSBuildCommand();
|
std::string const& GetMSBuildCommand();
|
||||||
|
|
||||||
std::string PlatformToolset;
|
std::string GeneratorToolset;
|
||||||
|
std::string DefaultPlatformToolset;
|
||||||
bool ExpressEdition;
|
bool ExpressEdition;
|
||||||
bool MasmEnabled;
|
bool MasmEnabled;
|
||||||
|
|
||||||
|
@ -122,5 +123,6 @@ private:
|
||||||
virtual std::string FindMSBuildCommand();
|
virtual std::string FindMSBuildCommand();
|
||||||
virtual std::string FindDevEnvCommand();
|
virtual std::string FindDevEnvCommand();
|
||||||
virtual std::string GetVSMakeProgram() { return this->GetMSBuildCommand(); }
|
virtual std::string GetVSMakeProgram() { return this->GetMSBuildCommand(); }
|
||||||
|
void AddVSPlatformToolsetDefinition(cmMakefile* mf) const;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -117,7 +117,7 @@ cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator(
|
||||||
this->ExpressEdition = cmSystemTools::ReadRegistryValue(
|
this->ExpressEdition = cmSystemTools::ReadRegistryValue(
|
||||||
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\11.0\\Setup\\VC;"
|
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\11.0\\Setup\\VC;"
|
||||||
"ProductDir", vc11Express, cmSystemTools::KeyWOW64_32);
|
"ProductDir", vc11Express, cmSystemTools::KeyWOW64_32);
|
||||||
this->PlatformToolset = "v110";
|
this->DefaultPlatformToolset = "v110";
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
|
@ -92,7 +92,7 @@ cmGlobalVisualStudio12Generator::cmGlobalVisualStudio12Generator(
|
||||||
this->ExpressEdition = cmSystemTools::ReadRegistryValue(
|
this->ExpressEdition = cmSystemTools::ReadRegistryValue(
|
||||||
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\12.0\\Setup\\VC;"
|
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\12.0\\Setup\\VC;"
|
||||||
"ProductDir", vc12Express, cmSystemTools::KeyWOW64_32);
|
"ProductDir", vc12Express, cmSystemTools::KeyWOW64_32);
|
||||||
this->PlatformToolset = "v120";
|
this->DefaultPlatformToolset = "v120";
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue