VS: Remove support for appending a platform to the generator name
Compatibility with CMake versions prior to 3.1 is no longer supported. Fixes: #26481
This commit is contained in:
parent
dc24d88062
commit
381c446ff7
@ -25,15 +25,18 @@ name (architecture). For example:
|
|||||||
* ``cmake -G "Visual Studio 14 2015" -A x64``
|
* ``cmake -G "Visual Studio 14 2015" -A x64``
|
||||||
* ``cmake -G "Visual Studio 14 2015" -A ARM``
|
* ``cmake -G "Visual Studio 14 2015" -A ARM``
|
||||||
|
|
||||||
For compatibility with CMake versions prior to 3.1, one may specify
|
.. versionchanged:: 4.0
|
||||||
a target platform name optionally at the end of the generator name.
|
|
||||||
This is supported only for:
|
|
||||||
|
|
||||||
``Visual Studio 14 2015 Win64``
|
Previously, for compatibility with CMake versions prior to 3.1,
|
||||||
Specify target platform ``x64``.
|
one could specify a target platform name optionally at the
|
||||||
|
end of the generator name. This has been removed.
|
||||||
|
This was supported only for:
|
||||||
|
|
||||||
``Visual Studio 14 2015 ARM``
|
``Visual Studio 14 2015 Win64``
|
||||||
Specify target platform ``ARM``.
|
Specify target platform ``x64``.
|
||||||
|
|
||||||
|
``Visual Studio 14 2015 ARM``
|
||||||
|
Specify target platform ``ARM``.
|
||||||
|
|
||||||
Toolset Selection
|
Toolset Selection
|
||||||
^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^
|
||||||
|
@ -34,15 +34,18 @@ name (architecture). For example:
|
|||||||
* ``cmake -G "Visual Studio 15 2017" -A ARM``
|
* ``cmake -G "Visual Studio 15 2017" -A ARM``
|
||||||
* ``cmake -G "Visual Studio 15 2017" -A ARM64``
|
* ``cmake -G "Visual Studio 15 2017" -A ARM64``
|
||||||
|
|
||||||
For compatibility with CMake versions prior to 3.1, one may specify
|
.. versionchanged:: 4.0
|
||||||
a target platform name optionally at the end of the generator name.
|
|
||||||
This is supported only for:
|
|
||||||
|
|
||||||
``Visual Studio 15 2017 Win64``
|
Previously, for compatibility with CMake versions prior to 3.1,
|
||||||
Specify target platform ``x64``.
|
one could specify a target platform name optionally at the
|
||||||
|
end of the generator name. This has been removed.
|
||||||
|
This was supported only for:
|
||||||
|
|
||||||
``Visual Studio 15 2017 ARM``
|
``Visual Studio 15 2017 Win64``
|
||||||
Specify target platform ``ARM``.
|
Specify target platform ``x64``.
|
||||||
|
|
||||||
|
``Visual Studio 15 2017 ARM``
|
||||||
|
Specify target platform ``ARM``.
|
||||||
|
|
||||||
Toolset Selection
|
Toolset Selection
|
||||||
^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^
|
||||||
|
@ -8,3 +8,7 @@ remove-old-compatibility
|
|||||||
CMake by using their ``VERSION`` arguments' ``<min>...<max>`` syntax.
|
CMake by using their ``VERSION`` arguments' ``<min>...<max>`` syntax.
|
||||||
This requires only the ``<min>`` version of CMake, but when running a
|
This requires only the ``<min>`` version of CMake, but when running a
|
||||||
newer version, sets policies up to the ``<max>`` version.
|
newer version, sets policies up to the ``<max>`` version.
|
||||||
|
|
||||||
|
* The :generator:`Visual Studio 14 2015` and :generator:`Visual Studio 15 2017`
|
||||||
|
generators no longer support specifying a platform as part of the generator
|
||||||
|
name. See :ref:`Visual Studio Platform Selection`.
|
||||||
|
@ -59,8 +59,7 @@ QCMake::QCMake(QObject* p)
|
|||||||
[this] { return this->interruptCallback(); });
|
[this] { return this->interruptCallback(); });
|
||||||
|
|
||||||
std::vector<cmake::GeneratorInfo> generators;
|
std::vector<cmake::GeneratorInfo> generators;
|
||||||
this->CMakeInstance->GetRegisteredGenerators(
|
this->CMakeInstance->GetRegisteredGenerators(generators);
|
||||||
generators, /*includeNamesWithPlatform=*/false);
|
|
||||||
|
|
||||||
for (cmake::GeneratorInfo const& gen : generators) {
|
for (cmake::GeneratorInfo const& gen : generators) {
|
||||||
this->AvailableGenerators.push_back(gen);
|
this->AvailableGenerators.push_back(gen);
|
||||||
|
@ -28,14 +28,13 @@ public:
|
|||||||
|
|
||||||
/** Create a GlobalGenerator */
|
/** Create a GlobalGenerator */
|
||||||
virtual std::unique_ptr<cmGlobalGenerator> CreateGlobalGenerator(
|
virtual std::unique_ptr<cmGlobalGenerator> CreateGlobalGenerator(
|
||||||
const std::string& n, bool allowArch, cmake* cm) const = 0;
|
const std::string& n, cmake* cm) const = 0;
|
||||||
|
|
||||||
/** Get the documentation entry for this factory */
|
/** Get the documentation entry for this factory */
|
||||||
virtual cmDocumentationEntry GetDocumentation() const = 0;
|
virtual cmDocumentationEntry GetDocumentation() const = 0;
|
||||||
|
|
||||||
/** Get the names of the current registered generators */
|
/** Get the names of the current registered generators */
|
||||||
virtual std::vector<std::string> GetGeneratorNames() 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 */
|
/** Determine whether or not this generator supports toolsets */
|
||||||
virtual bool SupportsToolset() const = 0;
|
virtual bool SupportsToolset() const = 0;
|
||||||
@ -56,7 +55,7 @@ class cmGlobalGeneratorSimpleFactory : public cmGlobalGeneratorFactory
|
|||||||
public:
|
public:
|
||||||
/** Create a GlobalGenerator */
|
/** Create a GlobalGenerator */
|
||||||
std::unique_ptr<cmGlobalGenerator> CreateGlobalGenerator(
|
std::unique_ptr<cmGlobalGenerator> CreateGlobalGenerator(
|
||||||
const std::string& name, bool /*allowArch*/, cmake* cm) const override
|
const std::string& name, cmake* cm) const override
|
||||||
{
|
{
|
||||||
if (name != T::GetActualName()) {
|
if (name != T::GetActualName()) {
|
||||||
return std::unique_ptr<cmGlobalGenerator>();
|
return std::unique_ptr<cmGlobalGenerator>();
|
||||||
@ -75,10 +74,6 @@ public:
|
|||||||
{
|
{
|
||||||
return { T::GetActualName() };
|
return { T::GetActualName() };
|
||||||
}
|
}
|
||||||
std::vector<std::string> GetGeneratorNamesWithPlatform() const override
|
|
||||||
{
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Determine whether or not this generator supports toolsets */
|
/** Determine whether or not this generator supports toolsets */
|
||||||
bool SupportsToolset() const override { return T::SupportsToolset(); }
|
bool SupportsToolset() const override { return T::SupportsToolset(); }
|
||||||
|
@ -53,9 +53,8 @@ static void ConvertToWindowsSlashes(std::string& s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator(
|
cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator(
|
||||||
cmake* cm, const std::string& name,
|
cmake* cm, const std::string& name)
|
||||||
std::string const& platformInGeneratorName)
|
: cmGlobalVisualStudio8Generator(cm, name)
|
||||||
: cmGlobalVisualStudio8Generator(cm, name, platformInGeneratorName)
|
|
||||||
{
|
{
|
||||||
this->DefaultCudaFlagTableName = "v10";
|
this->DefaultCudaFlagTableName = "v10";
|
||||||
this->DefaultCudaHostFlagTableName = "v10";
|
this->DefaultCudaHostFlagTableName = "v10";
|
||||||
@ -485,13 +484,6 @@ bool cmGlobalVisualStudio10Generator::InitializeSystem(cmMakefile* mf)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (this->SystemName == "Android"_s) {
|
} else if (this->SystemName == "Android"_s) {
|
||||||
if (this->PlatformInGeneratorName) {
|
|
||||||
mf->IssueMessage(
|
|
||||||
MessageType::FATAL_ERROR,
|
|
||||||
cmStrCat("CMAKE_SYSTEM_NAME is 'Android' but CMAKE_GENERATOR ",
|
|
||||||
"specifies a platform too: '", this->GetName(), '\''));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (mf->GetSafeDefinition("CMAKE_GENERATOR_PLATFORM") ==
|
if (mf->GetSafeDefinition("CMAKE_GENERATOR_PLATFORM") ==
|
||||||
"Tegra-Android"_s) {
|
"Tegra-Android"_s) {
|
||||||
if (!this->InitializeTegraAndroid(mf)) {
|
if (!this->InitializeTegraAndroid(mf)) {
|
||||||
@ -513,16 +505,8 @@ bool cmGlobalVisualStudio10Generator::InitializeWindows(cmMakefile*)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cmGlobalVisualStudio10Generator::InitializeWindowsCE(cmMakefile* mf)
|
bool cmGlobalVisualStudio10Generator::InitializeWindowsCE(cmMakefile*)
|
||||||
{
|
{
|
||||||
if (this->PlatformInGeneratorName) {
|
|
||||||
mf->IssueMessage(
|
|
||||||
MessageType::FATAL_ERROR,
|
|
||||||
cmStrCat("CMAKE_SYSTEM_NAME is 'WindowsCE' but CMAKE_GENERATOR ",
|
|
||||||
"specifies a platform too: '", this->GetName(), '\''));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
this->DefaultPlatformToolset = this->SelectWindowsCEToolset();
|
this->DefaultPlatformToolset = this->SelectWindowsCEToolset();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -185,8 +185,7 @@ public:
|
|||||||
bool IsBuildInParallelSupported() const;
|
bool IsBuildInParallelSupported() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
cmGlobalVisualStudio10Generator(cmake* cm, const std::string& name,
|
cmGlobalVisualStudio10Generator(cmake* cm, const std::string& name);
|
||||||
std::string const& platformInGeneratorName);
|
|
||||||
|
|
||||||
void Generate() override;
|
void Generate() override;
|
||||||
virtual bool InitializeSystem(cmMakefile* mf);
|
virtual bool InitializeSystem(cmMakefile* mf);
|
||||||
|
@ -16,9 +16,8 @@
|
|||||||
#include "cmSystemTools.h"
|
#include "cmSystemTools.h"
|
||||||
|
|
||||||
cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator(
|
cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator(
|
||||||
cmake* cm, const std::string& name,
|
cmake* cm, const std::string& name)
|
||||||
std::string const& platformInGeneratorName)
|
: cmGlobalVisualStudio10Generator(cm, name)
|
||||||
: cmGlobalVisualStudio10Generator(cm, name, platformInGeneratorName)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,8 +31,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
cmGlobalVisualStudio11Generator(cmake* cm, const std::string& name,
|
cmGlobalVisualStudio11Generator(cmake* cm, const std::string& name);
|
||||||
std::string const& platformInGeneratorName);
|
|
||||||
|
|
||||||
bool InitializeWindowsPhone(cmMakefile* mf) override;
|
bool InitializeWindowsPhone(cmMakefile* mf) override;
|
||||||
bool InitializeWindowsStore(cmMakefile* mf) override;
|
bool InitializeWindowsStore(cmMakefile* mf) override;
|
||||||
|
@ -16,9 +16,8 @@
|
|||||||
#include "cmSystemTools.h"
|
#include "cmSystemTools.h"
|
||||||
|
|
||||||
cmGlobalVisualStudio12Generator::cmGlobalVisualStudio12Generator(
|
cmGlobalVisualStudio12Generator::cmGlobalVisualStudio12Generator(
|
||||||
cmake* cm, const std::string& name,
|
cmake* cm, const std::string& name)
|
||||||
std::string const& platformInGeneratorName)
|
: cmGlobalVisualStudio11Generator(cm, name)
|
||||||
: cmGlobalVisualStudio11Generator(cm, name, platformInGeneratorName)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,8 +16,7 @@ class cmake;
|
|||||||
class cmGlobalVisualStudio12Generator : public cmGlobalVisualStudio11Generator
|
class cmGlobalVisualStudio12Generator : public cmGlobalVisualStudio11Generator
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
cmGlobalVisualStudio12Generator(cmake* cm, const std::string& name,
|
cmGlobalVisualStudio12Generator(cmake* cm, const std::string& name);
|
||||||
std::string const& platformInGeneratorName);
|
|
||||||
|
|
||||||
bool ProcessGeneratorToolsetField(std::string const& key,
|
bool ProcessGeneratorToolsetField(std::string const& key,
|
||||||
std::string const& value) override;
|
std::string const& value) override;
|
||||||
|
@ -40,7 +40,7 @@ class cmGlobalVisualStudio14Generator::Factory
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
std::unique_ptr<cmGlobalGenerator> CreateGlobalGenerator(
|
std::unique_ptr<cmGlobalGenerator> CreateGlobalGenerator(
|
||||||
const std::string& name, bool allowArch, cmake* cm) const override
|
const std::string& name, cmake* cm) const override
|
||||||
{
|
{
|
||||||
std::string genName;
|
std::string genName;
|
||||||
const char* p = cmVS14GenName(name, genName);
|
const char* p = cmVS14GenName(name, genName);
|
||||||
@ -49,18 +49,7 @@ public:
|
|||||||
}
|
}
|
||||||
if (!*p) {
|
if (!*p) {
|
||||||
return std::unique_ptr<cmGlobalGenerator>(
|
return std::unique_ptr<cmGlobalGenerator>(
|
||||||
new cmGlobalVisualStudio14Generator(cm, genName, ""));
|
new cmGlobalVisualStudio14Generator(cm, genName));
|
||||||
}
|
|
||||||
if (!allowArch || *p++ != ' ') {
|
|
||||||
return std::unique_ptr<cmGlobalGenerator>();
|
|
||||||
}
|
|
||||||
if (strcmp(p, "Win64") == 0) {
|
|
||||||
return std::unique_ptr<cmGlobalGenerator>(
|
|
||||||
new cmGlobalVisualStudio14Generator(cm, genName, "x64"));
|
|
||||||
}
|
|
||||||
if (strcmp(p, "ARM") == 0) {
|
|
||||||
return std::unique_ptr<cmGlobalGenerator>(
|
|
||||||
new cmGlobalVisualStudio14Generator(cm, genName, "ARM"));
|
|
||||||
}
|
}
|
||||||
return std::unique_ptr<cmGlobalGenerator>();
|
return std::unique_ptr<cmGlobalGenerator>();
|
||||||
}
|
}
|
||||||
@ -79,14 +68,6 @@ public:
|
|||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> GetGeneratorNamesWithPlatform() const override
|
|
||||||
{
|
|
||||||
std::vector<std::string> names;
|
|
||||||
names.emplace_back(cmStrCat(vs14generatorName, " ARM"));
|
|
||||||
names.emplace_back(cmStrCat(vs14generatorName, " Win64"));
|
|
||||||
return names;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SupportsToolset() const override { return true; }
|
bool SupportsToolset() const override { return true; }
|
||||||
bool SupportsPlatform() const override { return true; }
|
bool SupportsPlatform() const override { return true; }
|
||||||
|
|
||||||
@ -109,9 +90,8 @@ cmGlobalVisualStudio14Generator::NewFactory()
|
|||||||
}
|
}
|
||||||
|
|
||||||
cmGlobalVisualStudio14Generator::cmGlobalVisualStudio14Generator(
|
cmGlobalVisualStudio14Generator::cmGlobalVisualStudio14Generator(
|
||||||
cmake* cm, const std::string& name,
|
cmake* cm, const std::string& name)
|
||||||
std::string const& platformInGeneratorName)
|
: cmGlobalVisualStudio12Generator(cm, name)
|
||||||
: cmGlobalVisualStudio12Generator(cm, name, platformInGeneratorName)
|
|
||||||
{
|
{
|
||||||
std::string vc14Express;
|
std::string vc14Express;
|
||||||
this->ExpressEdition = cmSystemTools::ReadRegistryValue(
|
this->ExpressEdition = cmSystemTools::ReadRegistryValue(
|
||||||
|
@ -29,8 +29,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
cmGlobalVisualStudio14Generator(cmake* cm, const std::string& name,
|
cmGlobalVisualStudio14Generator(cmake* cm, const std::string& name);
|
||||||
std::string const& platformInGeneratorName);
|
|
||||||
|
|
||||||
bool InitializeWindowsStore(cmMakefile* mf) override;
|
bool InitializeWindowsStore(cmMakefile* mf) override;
|
||||||
bool InitializeAndroid(cmMakefile* mf) override;
|
bool InitializeAndroid(cmMakefile* mf) override;
|
||||||
|
@ -17,9 +17,8 @@
|
|||||||
|
|
||||||
class cmake;
|
class cmake;
|
||||||
|
|
||||||
cmGlobalVisualStudio71Generator::cmGlobalVisualStudio71Generator(
|
cmGlobalVisualStudio71Generator::cmGlobalVisualStudio71Generator(cmake* cm)
|
||||||
cmake* cm, const std::string& platformName)
|
: cmGlobalVisualStudio7Generator(cm)
|
||||||
: cmGlobalVisualStudio7Generator(cm, platformName)
|
|
||||||
{
|
{
|
||||||
this->ProjectConfigurationSectionName = "ProjectConfiguration";
|
this->ProjectConfigurationSectionName = "ProjectConfiguration";
|
||||||
}
|
}
|
||||||
|
@ -25,8 +25,7 @@ class BT;
|
|||||||
class cmGlobalVisualStudio71Generator : public cmGlobalVisualStudio7Generator
|
class cmGlobalVisualStudio71Generator : public cmGlobalVisualStudio7Generator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
cmGlobalVisualStudio71Generator(cmake* cm,
|
cmGlobalVisualStudio71Generator(cmake* cm);
|
||||||
const std::string& platformName = "");
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root,
|
void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root,
|
||||||
|
@ -66,9 +66,8 @@ std::string GetSLNFile(cmLocalGenerator* root)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cmGlobalVisualStudio7Generator::cmGlobalVisualStudio7Generator(
|
cmGlobalVisualStudio7Generator::cmGlobalVisualStudio7Generator(cmake* cm)
|
||||||
cmake* cm, std::string const& platformInGeneratorName)
|
: cmGlobalVisualStudioGenerator(cm)
|
||||||
: cmGlobalVisualStudioGenerator(cm, platformInGeneratorName)
|
|
||||||
{
|
{
|
||||||
this->DevEnvCommandInitialized = false;
|
this->DevEnvCommandInitialized = false;
|
||||||
this->MarmasmEnabled = false;
|
this->MarmasmEnabled = false;
|
||||||
|
@ -130,8 +130,7 @@ public:
|
|||||||
virtual bool SupportsCxxModuleDyndep() const { return false; }
|
virtual bool SupportsCxxModuleDyndep() const { return false; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
cmGlobalVisualStudio7Generator(cmake* cm,
|
cmGlobalVisualStudio7Generator(cmake* cm);
|
||||||
std::string const& platformInGeneratorName);
|
|
||||||
|
|
||||||
void Generate() override;
|
void Generate() override;
|
||||||
|
|
||||||
|
@ -39,9 +39,8 @@
|
|||||||
struct cmIDEFlagTable;
|
struct cmIDEFlagTable;
|
||||||
|
|
||||||
cmGlobalVisualStudio8Generator::cmGlobalVisualStudio8Generator(
|
cmGlobalVisualStudio8Generator::cmGlobalVisualStudio8Generator(
|
||||||
cmake* cm, const std::string& name,
|
cmake* cm, const std::string& name)
|
||||||
std::string const& platformInGeneratorName)
|
: cmGlobalVisualStudio71Generator(cm)
|
||||||
: cmGlobalVisualStudio71Generator(cm, platformInGeneratorName)
|
|
||||||
{
|
{
|
||||||
this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms";
|
this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms";
|
||||||
this->Name = name;
|
this->Name = name;
|
||||||
@ -88,13 +87,6 @@ void cmGlobalVisualStudio8Generator::AddPlatformDefinitions(cmMakefile* mf)
|
|||||||
bool cmGlobalVisualStudio8Generator::SetGeneratorPlatform(std::string const& p,
|
bool cmGlobalVisualStudio8Generator::SetGeneratorPlatform(std::string const& p,
|
||||||
cmMakefile* mf)
|
cmMakefile* mf)
|
||||||
{
|
{
|
||||||
if (this->PlatformInGeneratorName) {
|
|
||||||
// This is an old-style generator name that contains the platform name.
|
|
||||||
// No explicit platform specification is supported, so pass it through
|
|
||||||
// to our base class implementation, which errors on non-empty platforms.
|
|
||||||
return this->cmGlobalVisualStudio7Generator::SetGeneratorPlatform(p, mf);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this->ParseGeneratorPlatform(p, mf)) {
|
if (!this->ParseGeneratorPlatform(p, mf)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -51,8 +51,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
cmGlobalVisualStudio8Generator(cmake* cm, const std::string& name,
|
cmGlobalVisualStudio8Generator(cmake* cm, const std::string& name);
|
||||||
std::string const& platformInGeneratorName);
|
|
||||||
|
|
||||||
virtual bool ProcessGeneratorPlatformField(std::string const& key,
|
virtual bool ProcessGeneratorPlatformField(std::string const& key,
|
||||||
std::string const& value);
|
std::string const& value);
|
||||||
|
@ -36,20 +36,13 @@
|
|||||||
#include "cmTarget.h"
|
#include "cmTarget.h"
|
||||||
#include "cmake.h"
|
#include "cmake.h"
|
||||||
|
|
||||||
cmGlobalVisualStudioGenerator::cmGlobalVisualStudioGenerator(
|
cmGlobalVisualStudioGenerator::cmGlobalVisualStudioGenerator(cmake* cm)
|
||||||
cmake* cm, std::string const& platformInGeneratorName)
|
|
||||||
: cmGlobalGenerator(cm)
|
: cmGlobalGenerator(cm)
|
||||||
{
|
{
|
||||||
cm->GetState()->SetIsGeneratorMultiConfig(true);
|
cm->GetState()->SetIsGeneratorMultiConfig(true);
|
||||||
cm->GetState()->SetWindowsShell(true);
|
cm->GetState()->SetWindowsShell(true);
|
||||||
cm->GetState()->SetWindowsVSIDE(true);
|
cm->GetState()->SetWindowsVSIDE(true);
|
||||||
|
this->DefaultPlatformName = "Win32";
|
||||||
if (platformInGeneratorName.empty()) {
|
|
||||||
this->DefaultPlatformName = "Win32";
|
|
||||||
} else {
|
|
||||||
this->DefaultPlatformName = platformInGeneratorName;
|
|
||||||
this->PlatformInGeneratorName = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cmGlobalVisualStudioGenerator::~cmGlobalVisualStudioGenerator() = default;
|
cmGlobalVisualStudioGenerator::~cmGlobalVisualStudioGenerator() = default;
|
||||||
|
@ -159,8 +159,7 @@ public:
|
|||||||
bool IsVisualStudio() const override { return true; }
|
bool IsVisualStudio() const override { return true; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
cmGlobalVisualStudioGenerator(cmake* cm,
|
cmGlobalVisualStudioGenerator(cmake* cm);
|
||||||
std::string const& platformInGeneratorName);
|
|
||||||
|
|
||||||
virtual bool InitializePlatform(cmMakefile* mf);
|
virtual bool InitializePlatform(cmMakefile* mf);
|
||||||
|
|
||||||
@ -195,7 +194,6 @@ protected:
|
|||||||
|
|
||||||
std::string GeneratorPlatform;
|
std::string GeneratorPlatform;
|
||||||
std::string DefaultPlatformName;
|
std::string DefaultPlatformName;
|
||||||
bool PlatformInGeneratorName = false;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual std::string GetVSMakeProgram() = 0;
|
virtual std::string GetVSMakeProgram() = 0;
|
||||||
|
@ -205,7 +205,7 @@ class cmGlobalVisualStudioVersionedGenerator::Factory15
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
std::unique_ptr<cmGlobalGenerator> CreateGlobalGenerator(
|
std::unique_ptr<cmGlobalGenerator> CreateGlobalGenerator(
|
||||||
const std::string& name, bool allowArch, cmake* cm) const override
|
const std::string& name, cmake* cm) const override
|
||||||
{
|
{
|
||||||
std::string genName;
|
std::string genName;
|
||||||
const char* p = cmVS15GenName(name, genName);
|
const char* p = cmVS15GenName(name, genName);
|
||||||
@ -215,20 +215,7 @@ public:
|
|||||||
if (!*p) {
|
if (!*p) {
|
||||||
return std::unique_ptr<cmGlobalGenerator>(
|
return std::unique_ptr<cmGlobalGenerator>(
|
||||||
new cmGlobalVisualStudioVersionedGenerator(
|
new cmGlobalVisualStudioVersionedGenerator(
|
||||||
cmGlobalVisualStudioGenerator::VSVersion::VS15, cm, genName, ""));
|
cmGlobalVisualStudioGenerator::VSVersion::VS15, cm, genName));
|
||||||
}
|
|
||||||
if (!allowArch || *p++ != ' ') {
|
|
||||||
return std::unique_ptr<cmGlobalGenerator>();
|
|
||||||
}
|
|
||||||
if (strcmp(p, "Win64") == 0) {
|
|
||||||
return std::unique_ptr<cmGlobalGenerator>(
|
|
||||||
new cmGlobalVisualStudioVersionedGenerator(
|
|
||||||
cmGlobalVisualStudioGenerator::VSVersion::VS15, cm, genName, "x64"));
|
|
||||||
}
|
|
||||||
if (strcmp(p, "ARM") == 0) {
|
|
||||||
return std::unique_ptr<cmGlobalGenerator>(
|
|
||||||
new cmGlobalVisualStudioVersionedGenerator(
|
|
||||||
cmGlobalVisualStudioGenerator::VSVersion::VS15, cm, genName, "ARM"));
|
|
||||||
}
|
}
|
||||||
return std::unique_ptr<cmGlobalGenerator>();
|
return std::unique_ptr<cmGlobalGenerator>();
|
||||||
}
|
}
|
||||||
@ -247,14 +234,6 @@ public:
|
|||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> GetGeneratorNamesWithPlatform() const override
|
|
||||||
{
|
|
||||||
std::vector<std::string> names;
|
|
||||||
names.emplace_back(cmStrCat(vs15generatorName, " ARM"));
|
|
||||||
names.emplace_back(cmStrCat(vs15generatorName, " Win64"));
|
|
||||||
return names;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SupportsToolset() const override { return true; }
|
bool SupportsToolset() const override { return true; }
|
||||||
bool SupportsPlatform() const override { return true; }
|
bool SupportsPlatform() const override { return true; }
|
||||||
|
|
||||||
@ -314,7 +293,7 @@ class cmGlobalVisualStudioVersionedGenerator::Factory16
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
std::unique_ptr<cmGlobalGenerator> CreateGlobalGenerator(
|
std::unique_ptr<cmGlobalGenerator> CreateGlobalGenerator(
|
||||||
const std::string& name, bool /*allowArch*/, cmake* cm) const override
|
const std::string& name, cmake* cm) const override
|
||||||
{
|
{
|
||||||
std::string genName;
|
std::string genName;
|
||||||
const char* p = cmVS16GenName(name, genName);
|
const char* p = cmVS16GenName(name, genName);
|
||||||
@ -324,7 +303,7 @@ public:
|
|||||||
if (!*p) {
|
if (!*p) {
|
||||||
return std::unique_ptr<cmGlobalGenerator>(
|
return std::unique_ptr<cmGlobalGenerator>(
|
||||||
new cmGlobalVisualStudioVersionedGenerator(
|
new cmGlobalVisualStudioVersionedGenerator(
|
||||||
cmGlobalVisualStudioGenerator::VSVersion::VS16, cm, genName, ""));
|
cmGlobalVisualStudioGenerator::VSVersion::VS16, cm, genName));
|
||||||
}
|
}
|
||||||
return std::unique_ptr<cmGlobalGenerator>();
|
return std::unique_ptr<cmGlobalGenerator>();
|
||||||
}
|
}
|
||||||
@ -343,11 +322,6 @@ public:
|
|||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> GetGeneratorNamesWithPlatform() const override
|
|
||||||
{
|
|
||||||
return std::vector<std::string>();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SupportsToolset() const override { return true; }
|
bool SupportsToolset() const override { return true; }
|
||||||
bool SupportsPlatform() const override { return true; }
|
bool SupportsPlatform() const override { return true; }
|
||||||
|
|
||||||
@ -379,7 +353,7 @@ class cmGlobalVisualStudioVersionedGenerator::Factory17
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
std::unique_ptr<cmGlobalGenerator> CreateGlobalGenerator(
|
std::unique_ptr<cmGlobalGenerator> CreateGlobalGenerator(
|
||||||
const std::string& name, bool /*allowArch*/, cmake* cm) const override
|
const std::string& name, cmake* cm) const override
|
||||||
{
|
{
|
||||||
std::string genName;
|
std::string genName;
|
||||||
const char* p = cmVS17GenName(name, genName);
|
const char* p = cmVS17GenName(name, genName);
|
||||||
@ -389,7 +363,7 @@ public:
|
|||||||
if (!*p) {
|
if (!*p) {
|
||||||
return std::unique_ptr<cmGlobalGenerator>(
|
return std::unique_ptr<cmGlobalGenerator>(
|
||||||
new cmGlobalVisualStudioVersionedGenerator(
|
new cmGlobalVisualStudioVersionedGenerator(
|
||||||
cmGlobalVisualStudioGenerator::VSVersion::VS17, cm, genName, ""));
|
cmGlobalVisualStudioGenerator::VSVersion::VS17, cm, genName));
|
||||||
}
|
}
|
||||||
return std::unique_ptr<cmGlobalGenerator>();
|
return std::unique_ptr<cmGlobalGenerator>();
|
||||||
}
|
}
|
||||||
@ -408,11 +382,6 @@ public:
|
|||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> GetGeneratorNamesWithPlatform() const override
|
|
||||||
{
|
|
||||||
return std::vector<std::string>();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SupportsToolset() const override { return true; }
|
bool SupportsToolset() const override { return true; }
|
||||||
bool SupportsPlatform() const override { return true; }
|
bool SupportsPlatform() const override { return true; }
|
||||||
|
|
||||||
@ -440,9 +409,8 @@ cmGlobalVisualStudioVersionedGenerator::NewFactory17()
|
|||||||
}
|
}
|
||||||
|
|
||||||
cmGlobalVisualStudioVersionedGenerator::cmGlobalVisualStudioVersionedGenerator(
|
cmGlobalVisualStudioVersionedGenerator::cmGlobalVisualStudioVersionedGenerator(
|
||||||
VSVersion version, cmake* cm, const std::string& name,
|
VSVersion version, cmake* cm, const std::string& name)
|
||||||
std::string const& platformInGeneratorName)
|
: cmGlobalVisualStudio14Generator(cm, name)
|
||||||
: cmGlobalVisualStudio14Generator(cm, name, platformInGeneratorName)
|
|
||||||
, vsSetupAPIHelper(VSVersionToMajor(version))
|
, vsSetupAPIHelper(VSVersionToMajor(version))
|
||||||
{
|
{
|
||||||
this->Version = version;
|
this->Version = version;
|
||||||
|
@ -58,9 +58,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
cmGlobalVisualStudioVersionedGenerator(
|
cmGlobalVisualStudioVersionedGenerator(VSVersion version, cmake* cm,
|
||||||
VSVersion version, cmake* cm, const std::string& name,
|
const std::string& name);
|
||||||
std::string const& platformInGeneratorName);
|
|
||||||
|
|
||||||
bool SelectWindowsStoreToolset(std::string& toolset) const override;
|
bool SelectWindowsStoreToolset(std::string& toolset) const override;
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ class cmGlobalXCodeGenerator::Factory : public cmGlobalGeneratorFactory
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
std::unique_ptr<cmGlobalGenerator> CreateGlobalGenerator(
|
std::unique_ptr<cmGlobalGenerator> CreateGlobalGenerator(
|
||||||
const std::string& name, bool allowArch, cmake* cm) const override;
|
const std::string& name, cmake* cm) const override;
|
||||||
|
|
||||||
cmDocumentationEntry GetDocumentation() const override
|
cmDocumentationEntry GetDocumentation() const override
|
||||||
{
|
{
|
||||||
@ -162,11 +162,6 @@ public:
|
|||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> GetGeneratorNamesWithPlatform() const override
|
|
||||||
{
|
|
||||||
return std::vector<std::string>();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SupportsToolset() const override { return true; }
|
bool SupportsToolset() const override { return true; }
|
||||||
bool SupportsPlatform() const override { return false; }
|
bool SupportsPlatform() const override { return false; }
|
||||||
|
|
||||||
@ -210,7 +205,6 @@ std::unique_ptr<cmGlobalGeneratorFactory> cmGlobalXCodeGenerator::NewFactory()
|
|||||||
|
|
||||||
std::unique_ptr<cmGlobalGenerator>
|
std::unique_ptr<cmGlobalGenerator>
|
||||||
cmGlobalXCodeGenerator::Factory::CreateGlobalGenerator(const std::string& name,
|
cmGlobalXCodeGenerator::Factory::CreateGlobalGenerator(const std::string& name,
|
||||||
bool /*allowArch*/,
|
|
||||||
cmake* cm) const
|
cmake* cm) const
|
||||||
{
|
{
|
||||||
if (name != GetActualName()) {
|
if (name != GetActualName()) {
|
||||||
|
@ -1380,7 +1380,7 @@ void cmake::SetArgs(const std::vector<std::string>& args)
|
|||||||
"-G", "No generator specified for -G", CommandArgument::Values::One,
|
"-G", "No generator specified for -G", CommandArgument::Values::One,
|
||||||
CommandArgument::RequiresSeparator::No,
|
CommandArgument::RequiresSeparator::No,
|
||||||
[&](std::string const& value, cmake* state) -> bool {
|
[&](std::string const& value, cmake* state) -> bool {
|
||||||
bool valid = state->CreateAndSetGlobalGenerator(value, true);
|
bool valid = state->CreateAndSetGlobalGenerator(value);
|
||||||
badGeneratorName = !valid;
|
badGeneratorName = !valid;
|
||||||
return valid;
|
return valid;
|
||||||
});
|
});
|
||||||
@ -1569,8 +1569,7 @@ void cmake::SetArgs(const std::vector<std::string>& args)
|
|||||||
this->SetHomeOutputDirectory(expandedPreset->BinaryDir);
|
this->SetHomeOutputDirectory(expandedPreset->BinaryDir);
|
||||||
}
|
}
|
||||||
if (!this->GlobalGenerator && !expandedPreset->Generator.empty()) {
|
if (!this->GlobalGenerator && !expandedPreset->Generator.empty()) {
|
||||||
if (!this->CreateAndSetGlobalGenerator(expandedPreset->Generator,
|
if (!this->CreateAndSetGlobalGenerator(expandedPreset->Generator)) {
|
||||||
false)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1940,16 +1939,12 @@ void cmake::AddDefaultExtraGenerators()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmake::GetRegisteredGenerators(std::vector<GeneratorInfo>& generators,
|
void cmake::GetRegisteredGenerators(
|
||||||
bool includeNamesWithPlatform) const
|
std::vector<GeneratorInfo>& generators) const
|
||||||
{
|
{
|
||||||
for (const auto& gen : this->Generators) {
|
for (const auto& gen : this->Generators) {
|
||||||
std::vector<std::string> names = gen->GetGeneratorNames();
|
std::vector<std::string> names = gen->GetGeneratorNames();
|
||||||
|
|
||||||
if (includeNamesWithPlatform) {
|
|
||||||
cm::append(names, gen->GetGeneratorNamesWithPlatform());
|
|
||||||
}
|
|
||||||
|
|
||||||
for (std::string const& name : names) {
|
for (std::string const& name : names) {
|
||||||
GeneratorInfo info;
|
GeneratorInfo info;
|
||||||
info.supportsToolset = gen->SupportsToolset();
|
info.supportsToolset = gen->SupportsToolset();
|
||||||
@ -2017,7 +2012,7 @@ createExtraGenerator(
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<cmGlobalGenerator> cmake::CreateGlobalGenerator(
|
std::unique_ptr<cmGlobalGenerator> cmake::CreateGlobalGenerator(
|
||||||
const std::string& gname, bool allowArch)
|
const std::string& gname)
|
||||||
{
|
{
|
||||||
std::pair<std::unique_ptr<cmExternalMakefileProjectGenerator>, std::string>
|
std::pair<std::unique_ptr<cmExternalMakefileProjectGenerator>, std::string>
|
||||||
extra = createExtraGenerator(this->ExtraGenerators, gname);
|
extra = createExtraGenerator(this->ExtraGenerators, gname);
|
||||||
@ -2027,7 +2022,7 @@ std::unique_ptr<cmGlobalGenerator> cmake::CreateGlobalGenerator(
|
|||||||
|
|
||||||
std::unique_ptr<cmGlobalGenerator> generator;
|
std::unique_ptr<cmGlobalGenerator> generator;
|
||||||
for (const auto& g : this->Generators) {
|
for (const auto& g : this->Generators) {
|
||||||
generator = g->CreateGlobalGenerator(name, allowArch, this);
|
generator = g->CreateGlobalGenerator(name, this);
|
||||||
if (generator) {
|
if (generator) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2040,17 +2035,16 @@ std::unique_ptr<cmGlobalGenerator> cmake::CreateGlobalGenerator(
|
|||||||
return generator;
|
return generator;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cmake::CreateAndSetGlobalGenerator(const std::string& name,
|
bool cmake::CreateAndSetGlobalGenerator(const std::string& name)
|
||||||
bool allowArch)
|
|
||||||
{
|
{
|
||||||
auto gen = this->CreateGlobalGenerator(name, allowArch);
|
auto gen = this->CreateGlobalGenerator(name);
|
||||||
if (!gen) {
|
if (!gen) {
|
||||||
std::string kdevError;
|
std::string kdevError;
|
||||||
std::string vsError;
|
std::string vsError;
|
||||||
if (name.find("KDevelop3", 0) != std::string::npos) {
|
if (name.find("KDevelop3", 0) != std::string::npos) {
|
||||||
kdevError = "\nThe KDevelop3 generator is not supported anymore.";
|
kdevError = "\nThe KDevelop3 generator is not supported anymore.";
|
||||||
}
|
}
|
||||||
if (!allowArch && cmHasLiteralPrefix(name, "Visual Studio ") &&
|
if (cmHasLiteralPrefix(name, "Visual Studio ") &&
|
||||||
name.length() >= cmStrLen("Visual Studio xx xxxx ")) {
|
name.length() >= cmStrLen("Visual Studio xx xxxx ")) {
|
||||||
vsError = "\nUsing platforms in Visual Studio generator names is not "
|
vsError = "\nUsing platforms in Visual Studio generator names is not "
|
||||||
"supported in CMakePresets.json.";
|
"supported in CMakePresets.json.";
|
||||||
@ -2070,7 +2064,7 @@ bool cmake::CreateAndSetGlobalGenerator(const std::string& name,
|
|||||||
void cmake::PrintPresetList(const cmCMakePresetsGraph& graph) const
|
void cmake::PrintPresetList(const cmCMakePresetsGraph& graph) const
|
||||||
{
|
{
|
||||||
std::vector<GeneratorInfo> generators;
|
std::vector<GeneratorInfo> generators;
|
||||||
this->GetRegisteredGenerators(generators, false);
|
this->GetRegisteredGenerators(generators);
|
||||||
auto filter =
|
auto filter =
|
||||||
[&generators](const cmCMakePresetsGraph::ConfigurePreset& preset) -> bool {
|
[&generators](const cmCMakePresetsGraph::ConfigurePreset& preset) -> bool {
|
||||||
if (preset.Generator.empty()) {
|
if (preset.Generator.empty()) {
|
||||||
|
@ -246,10 +246,10 @@ public:
|
|||||||
|
|
||||||
//! Create a GlobalGenerator
|
//! Create a GlobalGenerator
|
||||||
std::unique_ptr<cmGlobalGenerator> CreateGlobalGenerator(
|
std::unique_ptr<cmGlobalGenerator> CreateGlobalGenerator(
|
||||||
const std::string& name, bool allowArch = true);
|
const std::string& name);
|
||||||
|
|
||||||
//! Create a GlobalGenerator and set it as our own
|
//! Create a GlobalGenerator and set it as our own
|
||||||
bool CreateAndSetGlobalGenerator(const std::string& name, bool allowArch);
|
bool CreateAndSetGlobalGenerator(const std::string& name);
|
||||||
|
|
||||||
#ifndef CMAKE_BOOTSTRAP
|
#ifndef CMAKE_BOOTSTRAP
|
||||||
//! Print list of configure presets
|
//! Print list of configure presets
|
||||||
@ -274,8 +274,7 @@ public:
|
|||||||
void SetGlobalGenerator(std::unique_ptr<cmGlobalGenerator>);
|
void SetGlobalGenerator(std::unique_ptr<cmGlobalGenerator>);
|
||||||
|
|
||||||
//! Get the names of the current registered generators
|
//! Get the names of the current registered generators
|
||||||
void GetRegisteredGenerators(std::vector<GeneratorInfo>& generators,
|
void GetRegisteredGenerators(std::vector<GeneratorInfo>& generators) const;
|
||||||
bool includeNamesWithPlatform = true) const;
|
|
||||||
|
|
||||||
//! Set the name of the selected generator-specific instance.
|
//! Set the name of the selected generator-specific instance.
|
||||||
void SetGeneratorInstance(std::string const& instance)
|
void SetGeneratorInstance(std::string const& instance)
|
||||||
|
Loading…
Reference in New Issue
Block a user