summaryrefslogtreecommitdiff
path: root/Source/cmGlobalVisualStudio11Generator.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmGlobalVisualStudio11Generator.cxx')
-rw-r--r--Source/cmGlobalVisualStudio11Generator.cxx97
1 files changed, 82 insertions, 15 deletions
diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx
index 624d01d69..8ae733165 100644
--- a/Source/cmGlobalVisualStudio11Generator.cxx
+++ b/Source/cmGlobalVisualStudio11Generator.cxx
@@ -13,31 +13,56 @@
#include "cmLocalVisualStudio10Generator.h"
#include "cmMakefile.h"
-static const char vs11Win32generatorName[] = "Visual Studio 11";
-static const char vs11Win64generatorName[] = "Visual Studio 11 Win64";
-static const char vs11ARMgeneratorName[] = "Visual Studio 11 ARM";
+static const char vs11generatorName[] = "Visual Studio 11";
class cmGlobalVisualStudio11Generator::Factory
: public cmGlobalGeneratorFactory
{
public:
virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const {
- if(!strcmp(name, vs11Win32generatorName))
+ if(strstr(name, vs11generatorName) != name)
+ {
+ return 0;
+ }
+
+ const char* p = name + sizeof(vs11generatorName) - 1;
+ if(p[0] == '\0')
{
return new cmGlobalVisualStudio11Generator(
- vs11Win32generatorName, NULL, NULL);
+ name, NULL, NULL);
+ }
+
+ if(p[0] != ' ')
+ {
+ return 0;
}
- if(!strcmp(name, vs11Win64generatorName))
+
+ ++p;
+
+ if(!strcmp(p, "ARM"))
{
return new cmGlobalVisualStudio11Generator(
- vs11Win64generatorName, "x64", "CMAKE_FORCE_WIN64");
+ name, "ARM", NULL);
}
- if(!strcmp(name, vs11ARMgeneratorName))
+
+ if(!strcmp(p, "Win64"))
{
return new cmGlobalVisualStudio11Generator(
- vs11ARMgeneratorName, "ARM", NULL);
+ name, "x64", "CMAKE_FORCE_WIN64");
}
- return 0;
+
+ std::set<std::string> installedSDKs =
+ cmGlobalVisualStudio11Generator::GetInstalledWindowsCESDKs();
+
+ if(installedSDKs.find(p) == installedSDKs.end())
+ {
+ return 0;
+ }
+
+ cmGlobalVisualStudio11Generator* ret =
+ new cmGlobalVisualStudio11Generator(name, p, NULL);
+ ret->WindowsCEVersion = "8.00";
+ return ret;
}
virtual void GetDocumentation(cmDocumentationEntry& entry) const {
@@ -51,9 +76,18 @@ public:
}
virtual void GetGenerators(std::vector<std::string>& names) const {
- names.push_back(vs11Win32generatorName);
- names.push_back(vs11Win64generatorName);
- names.push_back(vs11ARMgeneratorName); }
+ names.push_back(vs11generatorName);
+ names.push_back(vs11generatorName + std::string(" ARM"));
+ names.push_back(vs11generatorName + std::string(" Win64"));
+
+ std::set<std::string> installedSDKs =
+ cmGlobalVisualStudio11Generator::GetInstalledWindowsCESDKs();
+ for(std::set<std::string>::const_iterator i =
+ installedSDKs.begin(); i != installedSDKs.end(); ++i)
+ {
+ names.push_back("Visual Studio 11 " + *i);
+ }
+ }
};
//----------------------------------------------------------------------------
@@ -64,9 +98,9 @@ cmGlobalGeneratorFactory* cmGlobalVisualStudio11Generator::NewFactory()
//----------------------------------------------------------------------------
cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator(
- const char* name, const char* architectureId,
+ const char* name, const char* platformName,
const char* additionalPlatformDefinition)
- : cmGlobalVisualStudio10Generator(name, architectureId,
+ : cmGlobalVisualStudio10Generator(name, platformName,
additionalPlatformDefinition)
{
this->FindMakeProgramFile = "CMakeVS11FindMake.cmake";
@@ -109,3 +143,36 @@ bool cmGlobalVisualStudio11Generator::UseFolderProperty()
// Express editions in VS10 and earlier, but they are in VS11 Express.
return cmGlobalVisualStudio8Generator::UseFolderProperty();
}
+
+//----------------------------------------------------------------------------
+std::set<std::string>
+cmGlobalVisualStudio11Generator::GetInstalledWindowsCESDKs()
+{
+ const char sdksKey[] = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\"
+ "Windows CE Tools\\SDKs";
+
+ std::vector<std::string> subkeys;
+ cmSystemTools::GetRegistrySubKeys(sdksKey, subkeys,
+ cmSystemTools::KeyWOW64_32);
+
+ std::set<std::string> ret;
+ for(std::vector<std::string>::const_iterator i =
+ subkeys.begin(); i != subkeys.end(); ++i)
+ {
+ std::string key = sdksKey;
+ key += '\\';
+ key += *i;
+ key += ';';
+
+ std::string path;
+ if(cmSystemTools::ReadRegistryValue(key.c_str(),
+ path,
+ cmSystemTools::KeyWOW64_32) &&
+ !path.empty())
+ {
+ ret.insert(*i);
+ }
+ }
+
+ return ret;
+}