diff options
author | Brad King <brad.king@kitware.com> | 2019-01-18 16:08:45 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-01-18 17:29:53 (GMT) |
commit | 8144b00e32cf1e24daf41353cbcd1806311ceac9 (patch) | |
tree | 9dab608492a1c0faa7f5381524ffcd7d2c88334d | |
parent | b70c0aed5c616edce5cbc803c7de92580f835f90 (diff) | |
download | CMake-8144b00e32cf1e24daf41353cbcd1806311ceac9.zip CMake-8144b00e32cf1e24daf41353cbcd1806311ceac9.tar.gz CMake-8144b00e32cf1e24daf41353cbcd1806311ceac9.tar.bz2 |
Split global generator factory list with and without platforms
Replace `cmGlobalGeneratorFactory::GetGenerators` with a pair of methods
to split the list of generator names into those that have platforms in
the name and those that do not.
-rw-r--r-- | Source/cmGlobalGeneratorFactory.h | 11 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio10Generator.cxx | 10 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio11Generator.cxx | 11 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio12Generator.cxx | 10 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio14Generator.cxx | 10 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio9Generator.cxx | 10 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudioVersionedGenerator.cxx | 19 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 9 | ||||
-rw-r--r-- | Source/cmake.cxx | 14 | ||||
-rw-r--r-- | Source/cmake.h | 3 |
10 files changed, 92 insertions, 15 deletions
diff --git a/Source/cmGlobalGeneratorFactory.h b/Source/cmGlobalGeneratorFactory.h index 4e3e770..906ec9a 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<std::string>& names) const = 0; + virtual std::vector<std::string> GetGeneratorNames() const = 0; + virtual std::vector<std::string> 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<std::string>& names) const override + std::vector<std::string> GetGeneratorNames() const override { + std::vector<std::string> names; names.push_back(T::GetActualName()); + return names; + } + std::vector<std::string> GetGeneratorNamesWithPlatform() const override + { + return std::vector<std::string>(); } /** Determine whether or not this generator supports toolsets */ diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 79757a8..bf856ea 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<std::string>& names) const override + std::vector<std::string> GetGeneratorNames() const override { + std::vector<std::string> names; names.push_back(vs10generatorName); + return names; + } + + std::vector<std::string> GetGeneratorNamesWithPlatform() const override + { + std::vector<std::string> 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 36eb492..a44058b 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<std::string>& names) const override + std::vector<std::string> GetGeneratorNames() const override { + std::vector<std::string> names; names.push_back(vs11generatorName); + return names; + } + + std::vector<std::string> GetGeneratorNamesWithPlatform() const override + { + std::vector<std::string> 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 61034a7..cbd5085 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<std::string>& names) const override + std::vector<std::string> GetGeneratorNames() const override { + std::vector<std::string> names; names.push_back(vs12generatorName); + return names; + } + + std::vector<std::string> GetGeneratorNamesWithPlatform() const override + { + std::vector<std::string> 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 5ea5e67..47768a8 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<std::string>& names) const override + std::vector<std::string> GetGeneratorNames() const override { + std::vector<std::string> names; names.push_back(vs14generatorName); + return names; + } + + std::vector<std::string> GetGeneratorNamesWithPlatform() const override + { + std::vector<std::string> 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 445b40c..d72b25b 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<std::string>& names) const override + std::vector<std::string> GetGeneratorNames() const override { + std::vector<std::string> names; names.push_back(vs9generatorName); + return names; + } + + std::vector<std::string> GetGeneratorNamesWithPlatform() const override + { + std::vector<std::string> 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 15e52fe..0860294 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<std::string>& names) const override + std::vector<std::string> GetGeneratorNames() const override { + std::vector<std::string> names; names.push_back(vs15generatorName); + return names; + } + + std::vector<std::string> GetGeneratorNamesWithPlatform() const override + { + std::vector<std::string> 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<std::string>& names) const + std::vector<std::string> GetGeneratorNames() const override { + std::vector<std::string> names; names.push_back(vs16generatorName); + return names; + } + + std::vector<std::string> GetGeneratorNamesWithPlatform() const override + { + return std::vector<std::string>(); } bool SupportsToolset() const override { return true; } diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 6618351..e5ab0e1 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -133,9 +133,16 @@ public: cmGlobalXCodeGenerator::GetDocumentation(entry); } - void GetGenerators(std::vector<std::string>& names) const override + std::vector<std::string> GetGeneratorNames() const override { + std::vector<std::string> names; names.push_back(cmGlobalXCodeGenerator::GetActualName()); + return names; + } + + std::vector<std::string> GetGeneratorNamesWithPlatform() const override + { + return std::vector<std::string>(); } bool SupportsToolset() const override { return true; } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 9fcfbde..f320aff 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -959,12 +959,18 @@ void cmake::AddDefaultExtraGenerators() #endif } -void cmake::GetRegisteredGenerators( - std::vector<GeneratorInfo>& generators) const +void cmake::GetRegisteredGenerators(std::vector<GeneratorInfo>& generators, + bool includeNamesWithPlatform) const { for (cmGlobalGeneratorFactory* gen : this->Generators) { - std::vector<std::string> names; - gen->GetGenerators(names); + std::vector<std::string> names = gen->GetGeneratorNames(); + + if (includeNamesWithPlatform) { + std::vector<std::string> 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 cd8c622..b37cccd 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<GeneratorInfo>& generators) const; + void GetRegisteredGenerators(std::vector<GeneratorInfo>& generators, + bool includeNamesWithPlatform = true) const; ///! Set the name of the selected generator-specific instance. void SetGeneratorInstance(std::string const& instance) |