summaryrefslogtreecommitdiffstats
path: root/Source/cmake.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmake.cxx')
-rw-r--r--Source/cmake.cxx55
1 files changed, 55 insertions, 0 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 932c996..d57e981 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -659,6 +659,7 @@ void cmake::SetArgs(const std::vector<std::string>& args,
bool directoriesSetBefore)
{
bool directoriesSet = directoriesSetBefore;
+ bool haveToolset = false;
for(unsigned int i=1; i < args.size(); ++i)
{
std::string arg = args[i];
@@ -787,6 +788,27 @@ void cmake::SetArgs(const std::vector<std::string>& args,
"uninitialized variables.\n";
this->SetCheckSystemVars(true);
}
+ else if(arg.find("-T",0) == 0)
+ {
+ std::string value = arg.substr(2);
+ if(value.size() == 0)
+ {
+ ++i;
+ if(i >= args.size())
+ {
+ cmSystemTools::Error("No toolset specified for -T");
+ return;
+ }
+ value = args[i];
+ }
+ if(haveToolset)
+ {
+ cmSystemTools::Error("Multiple -T options not allowed");
+ return;
+ }
+ this->GeneratorToolset = value;
+ haveToolset = true;
+ }
else if(arg.find("-G",0) == 0)
{
std::string value = arg.substr(2);
@@ -2282,6 +2304,39 @@ int cmake::ActualConfigure()
cmCacheManager::INTERNAL);
}
+ if(const char* tsName =
+ this->CacheManager->GetCacheValue("CMAKE_GENERATOR_TOOLSET"))
+ {
+ if(this->GeneratorToolset.empty())
+ {
+ this->GeneratorToolset = tsName;
+ }
+ else if(this->GeneratorToolset != tsName)
+ {
+ std::string message = "Error: generator toolset: ";
+ message += this->GeneratorToolset;
+ message += "\nDoes not match the toolset used previously: ";
+ message += tsName;
+ message +=
+ "\nEither remove the CMakeCache.txt file or choose a different"
+ " binary directory.";
+ cmSystemTools::Error(message.c_str());
+ return -2;
+ }
+ }
+ else
+ {
+ this->CacheManager->AddCacheEntry("CMAKE_GENERATOR_TOOLSET",
+ this->GeneratorToolset.c_str(),
+ "Name of generator toolset.",
+ cmCacheManager::INTERNAL);
+ }
+ if(!this->GeneratorToolset.empty() &&
+ !this->GlobalGenerator->SetGeneratorToolset(this->GeneratorToolset))
+ {
+ return -2;
+ }
+
// reset any system configuration information, except for when we are
// InTryCompile. With TryCompile the system info is taken from the parent's
// info to save time