summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGlobalVisualStudio10Generator.cxx37
-rw-r--r--Source/cmGlobalVisualStudio10Generator.h5
-rw-r--r--Source/cmGlobalVisualStudio12Generator.cxx15
-rw-r--r--Source/cmGlobalVisualStudio12Generator.h3
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx13
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx9
6 files changed, 81 insertions, 1 deletions
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index caaac87f09..02ffa41696 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -145,10 +145,36 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset(
return false;
}
- this->GeneratorToolset = ts;
+ if (!this->ParseGeneratorToolset(ts, mf)) {
+ return false;
+ }
if (const char* toolset = this->GetPlatformToolset()) {
mf->AddDefinition("CMAKE_VS_PLATFORM_TOOLSET", toolset);
}
+ if (const char* hostArch = this->GetPlatformToolsetHostArchitecture()) {
+ mf->AddDefinition("CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE", hostArch);
+ }
+ return true;
+}
+
+bool cmGlobalVisualStudio10Generator::ParseGeneratorToolset(
+ std::string const& ts, cmMakefile* mf)
+{
+ if (ts.find_first_of(",=") != ts.npos) {
+ std::ostringstream e;
+ /* clang-format off */
+ e <<
+ "Generator\n"
+ " " << this->GetName() << "\n"
+ "does not recognize the toolset\n"
+ " " << ts << "\n"
+ "that was specified.";
+ /* clang-format on */
+ mf->IssueMessage(cmake::FATAL_ERROR, e.str());
+ return false;
+ }
+
+ this->GeneratorToolset = ts;
return true;
}
@@ -322,6 +348,15 @@ const char* cmGlobalVisualStudio10Generator::GetPlatformToolset() const
return 0;
}
+const char*
+cmGlobalVisualStudio10Generator::GetPlatformToolsetHostArchitecture() const
+{
+ if (!this->GeneratorToolsetHostArchitecture.empty()) {
+ return this->GeneratorToolsetHostArchitecture.c_str();
+ }
+ return CM_NULLPTR;
+}
+
void cmGlobalVisualStudio10Generator::FindMakeProgram(cmMakefile* mf)
{
this->cmGlobalVisualStudio8Generator::FindMakeProgram(mf);
diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h
index 19c60aa5fb..f8a50acf50 100644
--- a/Source/cmGlobalVisualStudio10Generator.h
+++ b/Source/cmGlobalVisualStudio10Generator.h
@@ -22,6 +22,7 @@ public:
virtual bool SetSystemName(std::string const& s, cmMakefile* mf);
virtual bool SetGeneratorPlatform(std::string const& p, cmMakefile* mf);
virtual bool SetGeneratorToolset(std::string const& ts, cmMakefile* mf);
+ virtual bool ParseGeneratorToolset(std::string const& ts, cmMakefile* mf);
virtual void GenerateBuildCommand(
std::vector<std::string>& makeCommand, const std::string& makeProgram,
@@ -48,6 +49,9 @@ public:
/** The toolset name for the target platform. */
const char* GetPlatformToolset() const;
+ /** The toolset host architecture name (e.g. x64 for 64-bit host tools). */
+ const char* GetPlatformToolsetHostArchitecture() const;
+
/** Return the CMAKE_SYSTEM_NAME. */
std::string const& GetSystemName() const { return this->SystemName; }
@@ -101,6 +105,7 @@ protected:
std::string const& GetMSBuildCommand();
std::string GeneratorToolset;
+ std::string GeneratorToolsetHostArchitecture;
std::string DefaultPlatformToolset;
std::string WindowsTargetPlatformVersion;
std::string SystemName;
diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx
index 5fdeec72ea..ec7916c33a 100644
--- a/Source/cmGlobalVisualStudio12Generator.cxx
+++ b/Source/cmGlobalVisualStudio12Generator.cxx
@@ -96,6 +96,21 @@ bool cmGlobalVisualStudio12Generator::MatchesGeneratorName(
return false;
}
+bool cmGlobalVisualStudio12Generator::ParseGeneratorToolset(
+ std::string const& ts, cmMakefile* mf)
+{
+ std::string::size_type ts_end = ts.size();
+ if (cmHasLiteralSuffix(ts, ",host=x64")) {
+ this->GeneratorToolsetHostArchitecture = "x64";
+ ts_end -= 9;
+ } else if (ts == "host=x64") {
+ this->GeneratorToolsetHostArchitecture = "x64";
+ ts_end = 0;
+ }
+ return this->cmGlobalVisualStudio11Generator::ParseGeneratorToolset(
+ ts.substr(0, ts_end), mf);
+}
+
bool cmGlobalVisualStudio12Generator::InitializeWindowsPhone(cmMakefile* mf)
{
if (!this->SelectWindowsPhoneToolset(this->DefaultPlatformToolset)) {
diff --git a/Source/cmGlobalVisualStudio12Generator.h b/Source/cmGlobalVisualStudio12Generator.h
index 78bb637333..cdda512f5f 100644
--- a/Source/cmGlobalVisualStudio12Generator.h
+++ b/Source/cmGlobalVisualStudio12Generator.h
@@ -22,6 +22,9 @@ public:
// version number
virtual const char* GetToolsVersion() { return "12.0"; }
protected:
+ bool ParseGeneratorToolset(std::string const& ts,
+ cmMakefile* mf) CM_OVERRIDE;
+
virtual bool InitializeWindowsPhone(cmMakefile* mf);
virtual bool InitializeWindowsStore(cmMakefile* mf);
virtual bool SelectWindowsPhoneToolset(std::string& toolset) const;
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 75fc2e44a3..0ddfc9a8c9 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -220,6 +220,19 @@ bool cmGlobalXCodeGenerator::SetGeneratorToolset(std::string const& ts,
cmMakefile* mf)
{
if (this->XcodeVersion >= 30) {
+ if (ts.find_first_of(",=") != ts.npos) {
+ std::ostringstream e;
+ /* clang-format off */
+ e <<
+ "Generator\n"
+ " " << this->GetName() << "\n"
+ "does not recognize the toolset\n"
+ " " << ts << "\n"
+ "that was specified.";
+ /* clang-format on */
+ mf->IssueMessage(cmake::FATAL_ERROR, e.str());
+ return false;
+ }
this->GeneratorToolset = ts;
if (!this->GeneratorToolset.empty()) {
mf->AddDefinition("CMAKE_XCODE_PLATFORM_TOOLSET",
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 6690bfa647..4a9df04726 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -322,6 +322,15 @@ void cmVisualStudio10TargetGenerator::Generate()
this->WriteString("</PropertyGroup>\n", 1);
}
+ if (const char* hostArch =
+ this->GlobalGenerator->GetPlatformToolsetHostArchitecture()) {
+ this->WriteString("<PropertyGroup>\n", 1);
+ this->WriteString("<PreferredToolArchitecture>", 2);
+ (*this->BuildFileStream) << cmVS10EscapeXML(hostArch)
+ << "</PreferredToolArchitecture>\n";
+ this->WriteString("</PropertyGroup>\n", 1);
+ }
+
this->WriteProjectConfigurations();
this->WriteString("<PropertyGroup Label=\"Globals\">\n", 1);
this->WriteString("<ProjectGUID>", 2);