diff --git a/Source/cmGlobalGeneratorFactory.h b/Source/cmGlobalGeneratorFactory.h index 4e3e7705b8..906ec9acf7 100644 --- a/Source/cmGlobalGeneratorFactory.h +++ b/Source/cmGlobalGeneratorFactory.h @@ -30,7 +30,8 @@ public: virtual void GetDocumentation(cmDocumentationEntry& entry) const = 0; /** Get the names of the current registered generators */ - virtual void GetGenerators(std::vector& names) const = 0; + virtual std::vector GetGeneratorNames() const = 0; + virtual std::vector GetGeneratorNamesWithPlatform() const = 0; /** Determine whether or not this generator supports toolsets */ virtual bool SupportsToolset() const = 0; @@ -60,9 +61,15 @@ public: } /** Get the names of the current registered generators */ - void GetGenerators(std::vector& names) const override + std::vector GetGeneratorNames() const override { + std::vector names; names.push_back(T::GetActualName()); + return names; + } + std::vector GetGeneratorNamesWithPlatform() const override + { + return std::vector(); } /** Determine whether or not this generator supports toolsets */ diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 79757a8751..bf856ead38 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -74,11 +74,19 @@ public: "Optional [arch] can be \"Win64\" or \"IA64\"."; } - void GetGenerators(std::vector& names) const override + std::vector GetGeneratorNames() const override { + std::vector names; names.push_back(vs10generatorName); + return names; + } + + std::vector GetGeneratorNamesWithPlatform() const override + { + std::vector names; names.push_back(vs10generatorName + std::string(" IA64")); names.push_back(vs10generatorName + std::string(" Win64")); + return names; } bool SupportsToolset() const override { return true; } diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx index 36eb492e14..a44058b622 100644 --- a/Source/cmGlobalVisualStudio11Generator.cxx +++ b/Source/cmGlobalVisualStudio11Generator.cxx @@ -69,9 +69,16 @@ public: "Optional [arch] can be \"Win64\" or \"ARM\"."; } - void GetGenerators(std::vector& names) const override + std::vector GetGeneratorNames() const override { + std::vector names; names.push_back(vs11generatorName); + return names; + } + + std::vector GetGeneratorNamesWithPlatform() const override + { + std::vector names; names.push_back(vs11generatorName + std::string(" ARM")); names.push_back(vs11generatorName + std::string(" Win64")); @@ -80,6 +87,8 @@ public: for (std::string const& i : installedSDKs) { names.push_back(std::string(vs11generatorName) + " " + i); } + + return names; } bool SupportsToolset() const override { return true; } diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx index 61034a7fa0..cbd5085be8 100644 --- a/Source/cmGlobalVisualStudio12Generator.cxx +++ b/Source/cmGlobalVisualStudio12Generator.cxx @@ -58,11 +58,19 @@ public: "Optional [arch] can be \"Win64\" or \"ARM\"."; } - void GetGenerators(std::vector& names) const override + std::vector GetGeneratorNames() const override { + std::vector names; names.push_back(vs12generatorName); + return names; + } + + std::vector GetGeneratorNamesWithPlatform() const override + { + std::vector names; names.push_back(vs12generatorName + std::string(" ARM")); names.push_back(vs12generatorName + std::string(" Win64")); + return names; } bool SupportsToolset() const override { return true; } diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx index 5ea5e6766d..47768a8865 100644 --- a/Source/cmGlobalVisualStudio14Generator.cxx +++ b/Source/cmGlobalVisualStudio14Generator.cxx @@ -58,11 +58,19 @@ public: "Optional [arch] can be \"Win64\" or \"ARM\"."; } - void GetGenerators(std::vector& names) const override + std::vector GetGeneratorNames() const override { + std::vector names; names.push_back(vs14generatorName); + return names; + } + + std::vector GetGeneratorNamesWithPlatform() const override + { + std::vector names; names.push_back(vs14generatorName + std::string(" ARM")); names.push_back(vs14generatorName + std::string(" Win64")); + return names; } bool SupportsToolset() const override { return true; } diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx index 445b40ce01..d72b25b4af 100644 --- a/Source/cmGlobalVisualStudio9Generator.cxx +++ b/Source/cmGlobalVisualStudio9Generator.cxx @@ -59,9 +59,16 @@ public: "Optional [arch] can be \"Win64\" or \"IA64\"."; } - void GetGenerators(std::vector& names) const override + std::vector GetGeneratorNames() const override { + std::vector names; names.push_back(vs9generatorName); + return names; + } + + std::vector GetGeneratorNamesWithPlatform() const override + { + std::vector names; names.push_back(vs9generatorName + std::string(" Win64")); names.push_back(vs9generatorName + std::string(" IA64")); cmVisualStudioWCEPlatformParser parser; @@ -71,6 +78,7 @@ public: for (std::string const& i : availablePlatforms) { names.push_back("Visual Studio 9 2008 " + i); } + return names; } bool SupportsToolset() const override { return false; } diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx index 15e52fec03..086029470b 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx +++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx @@ -132,11 +132,19 @@ public: "Optional [arch] can be \"Win64\" or \"ARM\"."; } - void GetGenerators(std::vector& names) const override + std::vector GetGeneratorNames() const override { + std::vector names; names.push_back(vs15generatorName); + return names; + } + + std::vector GetGeneratorNamesWithPlatform() const override + { + std::vector names; names.push_back(vs15generatorName + std::string(" ARM")); names.push_back(vs15generatorName + std::string(" Win64")); + return names; } bool SupportsToolset() const override { return true; } @@ -192,9 +200,16 @@ public: "Use -A option to specify architecture."; } - virtual void GetGenerators(std::vector& names) const + std::vector GetGeneratorNames() const override { + std::vector names; names.push_back(vs16generatorName); + return names; + } + + std::vector GetGeneratorNamesWithPlatform() const override + { + return std::vector(); } bool SupportsToolset() const override { return true; } diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 6618351493..e5ab0e1b46 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -133,9 +133,16 @@ public: cmGlobalXCodeGenerator::GetDocumentation(entry); } - void GetGenerators(std::vector& names) const override + std::vector GetGeneratorNames() const override { + std::vector names; names.push_back(cmGlobalXCodeGenerator::GetActualName()); + return names; + } + + std::vector GetGeneratorNamesWithPlatform() const override + { + return std::vector(); } bool SupportsToolset() const override { return true; } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 9fcfbde93a..f320aff75f 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -959,12 +959,18 @@ void cmake::AddDefaultExtraGenerators() #endif } -void cmake::GetRegisteredGenerators( - std::vector& generators) const +void cmake::GetRegisteredGenerators(std::vector& generators, + bool includeNamesWithPlatform) const { for (cmGlobalGeneratorFactory* gen : this->Generators) { - std::vector names; - gen->GetGenerators(names); + std::vector names = gen->GetGeneratorNames(); + + if (includeNamesWithPlatform) { + std::vector namesWithPlatform = + gen->GetGeneratorNamesWithPlatform(); + names.insert(names.end(), namesWithPlatform.begin(), + namesWithPlatform.end()); + } for (std::string const& name : names) { GeneratorInfo info; diff --git a/Source/cmake.h b/Source/cmake.h index cd8c622413..b37cccd96f 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -196,7 +196,8 @@ public: void SetGlobalGenerator(cmGlobalGenerator*); ///! Get the names of the current registered generators - void GetRegisteredGenerators(std::vector& generators) const; + void GetRegisteredGenerators(std::vector& generators, + bool includeNamesWithPlatform = true) const; ///! Set the name of the selected generator-specific instance. void SetGeneratorInstance(std::string const& instance)