From a88f98b3bea7822ad1c0f77e6f92e7277ced5ad9 Mon Sep 17 00:00:00 2001 From: Sumit Bhardwaj Date: Tue, 25 Jan 2022 11:25:18 -0800 Subject: Make cmGlobalVisualStudioGenerator::VSVersion enum class --- Source/cmGlobalVisualStudio10Generator.cxx | 28 +++--- Source/cmGlobalVisualStudio11Generator.cxx | 2 +- Source/cmGlobalVisualStudio12Generator.cxx | 2 +- Source/cmGlobalVisualStudio14Generator.cxx | 2 +- Source/cmGlobalVisualStudio7Generator.cxx | 3 +- Source/cmGlobalVisualStudio9Generator.cxx | 2 +- Source/cmGlobalVisualStudioGenerator.cxx | 32 +++--- Source/cmGlobalVisualStudioGenerator.h | 2 +- Source/cmGlobalVisualStudioVersionedGenerator.cxx | 114 +++++++++++----------- Source/cmLocalVisualStudio7Generator.cxx | 13 ++- Source/cmVisualStudio10TargetGenerator.cxx | 18 ++-- Source/cmVisualStudioGeneratorOptions.cxx | 29 +++--- 12 files changed, 126 insertions(+), 121 deletions(-) diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index e9824fb..a52c831 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -170,7 +170,7 @@ cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator( this->DefaultNasmFlagTableName = "v10"; this->DefaultRCFlagTableName = "v10"; - this->Version = VS10; + this->Version = VSVersion::VS10; this->PlatformToolsetNeedsDebugEnum = false; } @@ -277,8 +277,8 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset( } this->SupportsUnityBuilds = - this->Version >= cmGlobalVisualStudioGenerator::VS16 || - (this->Version == cmGlobalVisualStudioGenerator::VS15 && + this->Version >= cmGlobalVisualStudioGenerator::VSVersion::VS16 || + (this->Version == cmGlobalVisualStudioGenerator::VSVersion::VS15 && cmSystemTools::PathExists(this->VCTargetsPath + "/Microsoft.Cpp.Unity.targets")); @@ -591,7 +591,7 @@ bool cmGlobalVisualStudio10Generator::InitializeWindowsCE(cmMakefile* mf) this->DefaultPlatformToolset = this->SelectWindowsCEToolset(); - if (this->GetVersion() == cmGlobalVisualStudioGenerator::VS12) { + if (this->GetVersion() == cmGlobalVisualStudioGenerator::VSVersion::VS12) { // VS 12 .NET CF defaults to .NET framework 3.9 for Windows CE. this->DefaultTargetFrameworkVersion = "v3.9"; this->DefaultTargetFrameworkIdentifier = "WindowsEmbeddedCompact"; @@ -1210,7 +1210,7 @@ cmGlobalVisualStudio10Generator::GenerateBuildCommand( // Invoke restore target, unless it has been explicitly disabled. bool restorePackages = true; - if (this->Version < VS15) { + if (this->Version < VSVersion::VS15) { // Package restore is only supported starting from Visual Studio // 2017. Package restore must be executed manually using NuGet // shell for older versions. @@ -1347,23 +1347,23 @@ std::string cmGlobalVisualStudio10Generator::Encoding() const char* cmGlobalVisualStudio10Generator::GetToolsVersion() const { switch (this->Version) { - case cmGlobalVisualStudioGenerator::VS9: - case cmGlobalVisualStudioGenerator::VS10: - case cmGlobalVisualStudioGenerator::VS11: + case cmGlobalVisualStudioGenerator::VSVersion::VS9: + case cmGlobalVisualStudioGenerator::VSVersion::VS10: + case cmGlobalVisualStudioGenerator::VSVersion::VS11: return "4.0"; // in Visual Studio 2013 they detached the MSBuild tools version // from the .Net Framework version and instead made it have it's own // version number - case cmGlobalVisualStudioGenerator::VS12: + case cmGlobalVisualStudioGenerator::VSVersion::VS12: return "12.0"; - case cmGlobalVisualStudioGenerator::VS14: + case cmGlobalVisualStudioGenerator::VSVersion::VS14: return "14.0"; - case cmGlobalVisualStudioGenerator::VS15: + case cmGlobalVisualStudioGenerator::VSVersion::VS15: return "15.0"; - case cmGlobalVisualStudioGenerator::VS16: + case cmGlobalVisualStudioGenerator::VSVersion::VS16: return "16.0"; - case cmGlobalVisualStudioGenerator::VS17: + case cmGlobalVisualStudioGenerator::VSVersion::VS17: return "17.0"; } return ""; @@ -1624,7 +1624,7 @@ cmIDEFlagTable const* cmGlobalVisualStudio10Generator::GetNasmFlagTable() const bool cmGlobalVisualStudio10Generator::IsMsBuildRestoreSupported() const { - if (this->Version >= VS16) { + if (this->Version >= VSVersion::VS16) { return true; } diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx index 6126cb4..10dc258 100644 --- a/Source/cmGlobalVisualStudio11Generator.cxx +++ b/Source/cmGlobalVisualStudio11Generator.cxx @@ -148,7 +148,7 @@ cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator( this->DefaultLinkFlagTableName = "v11"; this->DefaultMasmFlagTableName = "v11"; this->DefaultRCFlagTableName = "v11"; - this->Version = VS11; + this->Version = VSVersion::VS11; } bool cmGlobalVisualStudio11Generator::MatchesGeneratorName( diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx index d8c1b43..12ffa5b 100644 --- a/Source/cmGlobalVisualStudio12Generator.cxx +++ b/Source/cmGlobalVisualStudio12Generator.cxx @@ -122,7 +122,7 @@ cmGlobalVisualStudio12Generator::cmGlobalVisualStudio12Generator( this->DefaultLinkFlagTableName = "v12"; this->DefaultMasmFlagTableName = "v12"; this->DefaultRCFlagTableName = "v12"; - this->Version = VS12; + this->Version = VSVersion::VS12; } bool cmGlobalVisualStudio12Generator::MatchesGeneratorName( diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx index 014668f..9f94cca 100644 --- a/Source/cmGlobalVisualStudio14Generator.cxx +++ b/Source/cmGlobalVisualStudio14Generator.cxx @@ -125,7 +125,7 @@ cmGlobalVisualStudio14Generator::cmGlobalVisualStudio14Generator( this->DefaultLinkFlagTableName = "v140"; this->DefaultMasmFlagTableName = "v14"; this->DefaultRCFlagTableName = "v14"; - this->Version = VS14; + this->Version = VSVersion::VS14; } bool cmGlobalVisualStudio14Generator::MatchesGeneratorName( diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 91012dd..134937e 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -304,7 +304,8 @@ void cmGlobalVisualStudio7Generator::Generate() GetSLNFile(this->LocalGenerators[0].get())); } - if (this->Version == VS10 && !this->CMakeInstance->GetIsInTryCompile()) { + if (this->Version == VSVersion::VS10 && + !this->CMakeInstance->GetIsInTryCompile()) { std::string cmakeWarnVS10; if (cmValue cached = this->CMakeInstance->GetState()->GetCacheEntryValue( "CMAKE_WARN_VS10")) { diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx index 5f867f5..e03e665 100644 --- a/Source/cmGlobalVisualStudio9Generator.cxx +++ b/Source/cmGlobalVisualStudio9Generator.cxx @@ -124,7 +124,7 @@ cmGlobalVisualStudio9Generator::cmGlobalVisualStudio9Generator( std::string const& platformInGeneratorName) : cmGlobalVisualStudio8Generator(cm, name, platformInGeneratorName) { - this->Version = VS9; + this->Version = VSVersion::VS9; std::string vc9Express; this->ExpressEdition = cmSystemTools::ReadRegistryValue( "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\9.0\\Setup\\VC;" diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 948fa53..141b5eb 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -97,21 +97,21 @@ std::string const& cmGlobalVisualStudioGenerator::GetPlatformName() const const char* cmGlobalVisualStudioGenerator::GetIDEVersion() const { switch (this->Version) { - case cmGlobalVisualStudioGenerator::VS9: + case cmGlobalVisualStudioGenerator::VSVersion::VS9: return "9.0"; - case cmGlobalVisualStudioGenerator::VS10: + case cmGlobalVisualStudioGenerator::VSVersion::VS10: return "10.0"; - case cmGlobalVisualStudioGenerator::VS11: + case cmGlobalVisualStudioGenerator::VSVersion::VS11: return "11.0"; - case cmGlobalVisualStudioGenerator::VS12: + case cmGlobalVisualStudioGenerator::VSVersion::VS12: return "12.0"; - case cmGlobalVisualStudioGenerator::VS14: + case cmGlobalVisualStudioGenerator::VSVersion::VS14: return "14.0"; - case cmGlobalVisualStudioGenerator::VS15: + case cmGlobalVisualStudioGenerator::VSVersion::VS15: return "15.0"; - case cmGlobalVisualStudioGenerator::VS16: + case cmGlobalVisualStudioGenerator::VSVersion::VS16: return "16.0"; - case cmGlobalVisualStudioGenerator::VS17: + case cmGlobalVisualStudioGenerator::VSVersion::VS17: return "17.0"; } return ""; @@ -124,11 +124,11 @@ void cmGlobalVisualStudioGenerator::WriteSLNHeader(std::ostream& fout) fout << '\n'; switch (this->Version) { - case cmGlobalVisualStudioGenerator::VS9: + case cmGlobalVisualStudioGenerator::VSVersion::VS9: fout << "Microsoft Visual Studio Solution File, Format Version 10.00\n"; fout << "# Visual Studio 2008\n"; break; - case cmGlobalVisualStudioGenerator::VS10: + case cmGlobalVisualStudioGenerator::VSVersion::VS10: fout << "Microsoft Visual Studio Solution File, Format Version 11.00\n"; if (this->ExpressEdition) { fout << "# Visual C++ Express 2010\n"; @@ -136,7 +136,7 @@ void cmGlobalVisualStudioGenerator::WriteSLNHeader(std::ostream& fout) fout << "# Visual Studio 2010\n"; } break; - case cmGlobalVisualStudioGenerator::VS11: + case cmGlobalVisualStudioGenerator::VSVersion::VS11: fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n"; if (this->ExpressEdition) { fout << "# Visual Studio Express 2012 for Windows Desktop\n"; @@ -144,7 +144,7 @@ void cmGlobalVisualStudioGenerator::WriteSLNHeader(std::ostream& fout) fout << "# Visual Studio 2012\n"; } break; - case cmGlobalVisualStudioGenerator::VS12: + case cmGlobalVisualStudioGenerator::VSVersion::VS12: fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n"; if (this->ExpressEdition) { fout << "# Visual Studio Express 2013 for Windows Desktop\n"; @@ -152,7 +152,7 @@ void cmGlobalVisualStudioGenerator::WriteSLNHeader(std::ostream& fout) fout << "# Visual Studio 2013\n"; } break; - case cmGlobalVisualStudioGenerator::VS14: + case cmGlobalVisualStudioGenerator::VSVersion::VS14: // Visual Studio 14 writes .sln format 12.00 fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n"; if (this->ExpressEdition) { @@ -161,7 +161,7 @@ void cmGlobalVisualStudioGenerator::WriteSLNHeader(std::ostream& fout) fout << "# Visual Studio 14\n"; } break; - case cmGlobalVisualStudioGenerator::VS15: + case cmGlobalVisualStudioGenerator::VSVersion::VS15: // Visual Studio 15 writes .sln format 12.00 fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n"; if (this->ExpressEdition) { @@ -170,7 +170,7 @@ void cmGlobalVisualStudioGenerator::WriteSLNHeader(std::ostream& fout) fout << "# Visual Studio 15\n"; } break; - case cmGlobalVisualStudioGenerator::VS16: + case cmGlobalVisualStudioGenerator::VSVersion::VS16: // Visual Studio 16 writes .sln format 12.00 fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n"; if (this->ExpressEdition) { @@ -179,7 +179,7 @@ void cmGlobalVisualStudioGenerator::WriteSLNHeader(std::ostream& fout) fout << "# Visual Studio Version 16\n"; } break; - case cmGlobalVisualStudioGenerator::VS17: + case cmGlobalVisualStudioGenerator::VSVersion::VS17: // Visual Studio 17 writes .sln format 12.00 fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n"; if (this->ExpressEdition) { diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index 1eff135..cb1b14b 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -32,7 +32,7 @@ class cmGlobalVisualStudioGenerator : public cmGlobalGenerator { public: /** Known versions of Visual Studio. */ - enum VSVersion + enum class VSVersion : uint16_t { VS9 = 90, VS10 = 100, diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx index ef8fee1..bc38335 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx +++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx @@ -75,21 +75,21 @@ static unsigned int VSVersionToMajor( cmGlobalVisualStudioGenerator::VSVersion v) { switch (v) { - case cmGlobalVisualStudioGenerator::VS9: + case cmGlobalVisualStudioGenerator::VSVersion::VS9: return 9; - case cmGlobalVisualStudioGenerator::VS10: + case cmGlobalVisualStudioGenerator::VSVersion::VS10: return 10; - case cmGlobalVisualStudioGenerator::VS11: + case cmGlobalVisualStudioGenerator::VSVersion::VS11: return 11; - case cmGlobalVisualStudioGenerator::VS12: + case cmGlobalVisualStudioGenerator::VSVersion::VS12: return 12; - case cmGlobalVisualStudioGenerator::VS14: + case cmGlobalVisualStudioGenerator::VSVersion::VS14: return 14; - case cmGlobalVisualStudioGenerator::VS15: + case cmGlobalVisualStudioGenerator::VSVersion::VS15: return 15; - case cmGlobalVisualStudioGenerator::VS16: + case cmGlobalVisualStudioGenerator::VSVersion::VS16: return 16; - case cmGlobalVisualStudioGenerator::VS17: + case cmGlobalVisualStudioGenerator::VSVersion::VS17: return 17; } return 0; @@ -99,21 +99,21 @@ static const char* VSVersionToToolset( cmGlobalVisualStudioGenerator::VSVersion v) { switch (v) { - case cmGlobalVisualStudioGenerator::VS9: + case cmGlobalVisualStudioGenerator::VSVersion::VS9: return "v90"; - case cmGlobalVisualStudioGenerator::VS10: + case cmGlobalVisualStudioGenerator::VSVersion::VS10: return "v100"; - case cmGlobalVisualStudioGenerator::VS11: + case cmGlobalVisualStudioGenerator::VSVersion::VS11: return "v110"; - case cmGlobalVisualStudioGenerator::VS12: + case cmGlobalVisualStudioGenerator::VSVersion::VS12: return "v120"; - case cmGlobalVisualStudioGenerator::VS14: + case cmGlobalVisualStudioGenerator::VSVersion::VS14: return "v140"; - case cmGlobalVisualStudioGenerator::VS15: + case cmGlobalVisualStudioGenerator::VSVersion::VS15: return "v141"; - case cmGlobalVisualStudioGenerator::VS16: + case cmGlobalVisualStudioGenerator::VSVersion::VS16: return "v142"; - case cmGlobalVisualStudioGenerator::VS17: + case cmGlobalVisualStudioGenerator::VSVersion::VS17: return "v143"; } return ""; @@ -123,21 +123,21 @@ static std::string VSVersionToMajorString( cmGlobalVisualStudioGenerator::VSVersion v) { switch (v) { - case cmGlobalVisualStudioGenerator::VS9: + case cmGlobalVisualStudioGenerator::VSVersion::VS9: return "9"; - case cmGlobalVisualStudioGenerator::VS10: + case cmGlobalVisualStudioGenerator::VSVersion::VS10: return "10"; - case cmGlobalVisualStudioGenerator::VS11: + case cmGlobalVisualStudioGenerator::VSVersion::VS11: return "11"; - case cmGlobalVisualStudioGenerator::VS12: + case cmGlobalVisualStudioGenerator::VSVersion::VS12: return "12"; - case cmGlobalVisualStudioGenerator::VS14: + case cmGlobalVisualStudioGenerator::VSVersion::VS14: return "14"; - case cmGlobalVisualStudioGenerator::VS15: + case cmGlobalVisualStudioGenerator::VSVersion::VS15: return "15"; - case cmGlobalVisualStudioGenerator::VS16: + case cmGlobalVisualStudioGenerator::VSVersion::VS16: return "16"; - case cmGlobalVisualStudioGenerator::VS17: + case cmGlobalVisualStudioGenerator::VSVersion::VS17: return "17"; } return ""; @@ -147,16 +147,16 @@ static const char* VSVersionToAndroidToolset( cmGlobalVisualStudioGenerator::VSVersion v) { switch (v) { - case cmGlobalVisualStudioGenerator::VS9: - case cmGlobalVisualStudioGenerator::VS10: - case cmGlobalVisualStudioGenerator::VS11: - case cmGlobalVisualStudioGenerator::VS12: + case cmGlobalVisualStudioGenerator::VSVersion::VS9: + case cmGlobalVisualStudioGenerator::VSVersion::VS10: + case cmGlobalVisualStudioGenerator::VSVersion::VS11: + case cmGlobalVisualStudioGenerator::VSVersion::VS12: return ""; - case cmGlobalVisualStudioGenerator::VS14: + case cmGlobalVisualStudioGenerator::VSVersion::VS14: return "Clang_3_8"; - case cmGlobalVisualStudioGenerator::VS15: - case cmGlobalVisualStudioGenerator::VS16: - case cmGlobalVisualStudioGenerator::VS17: + case cmGlobalVisualStudioGenerator::VSVersion::VS15: + case cmGlobalVisualStudioGenerator::VSVersion::VS16: + case cmGlobalVisualStudioGenerator::VSVersion::VS17: return "Clang_5_0"; } return ""; @@ -194,7 +194,7 @@ public: if (!*p) { return std::unique_ptr( new cmGlobalVisualStudioVersionedGenerator( - cmGlobalVisualStudioGenerator::VS15, cm, genName, "")); + cmGlobalVisualStudioGenerator::VSVersion::VS15, cm, genName, "")); } if (!allowArch || *p++ != ' ') { return std::unique_ptr(); @@ -202,12 +202,12 @@ public: if (strcmp(p, "Win64") == 0) { return std::unique_ptr( new cmGlobalVisualStudioVersionedGenerator( - cmGlobalVisualStudioGenerator::VS15, cm, genName, "x64")); + cmGlobalVisualStudioGenerator::VSVersion::VS15, cm, genName, "x64")); } if (strcmp(p, "ARM") == 0) { return std::unique_ptr( new cmGlobalVisualStudioVersionedGenerator( - cmGlobalVisualStudioGenerator::VS15, cm, genName, "ARM")); + cmGlobalVisualStudioGenerator::VSVersion::VS15, cm, genName, "ARM")); } return std::unique_ptr(); } @@ -303,7 +303,7 @@ public: if (!*p) { return std::unique_ptr( new cmGlobalVisualStudioVersionedGenerator( - cmGlobalVisualStudioGenerator::VS16, cm, genName, "")); + cmGlobalVisualStudioGenerator::VSVersion::VS16, cm, genName, "")); } return std::unique_ptr(); } @@ -368,7 +368,7 @@ public: if (!*p) { return std::unique_ptr( new cmGlobalVisualStudioVersionedGenerator( - cmGlobalVisualStudioGenerator::VS17, cm, genName, "")); + cmGlobalVisualStudioGenerator::VSVersion::VS17, cm, genName, "")); } return std::unique_ptr(); } @@ -431,11 +431,11 @@ cmGlobalVisualStudioVersionedGenerator::cmGlobalVisualStudioVersionedGenerator( this->DefaultCLFlagTableName = VSVersionToToolset(this->Version); this->DefaultCSharpFlagTableName = VSVersionToToolset(this->Version); this->DefaultLinkFlagTableName = VSVersionToToolset(this->Version); - if (this->Version >= cmGlobalVisualStudioGenerator::VS16) { + if (this->Version >= cmGlobalVisualStudioGenerator::VSVersion::VS16) { this->DefaultPlatformName = VSHostPlatformName(); this->DefaultPlatformToolsetHostArchitecture = VSHostArchitecture(); } - if (this->Version >= cmGlobalVisualStudioGenerator::VS17) { + if (this->Version >= cmGlobalVisualStudioGenerator::VSVersion::VS17) { // FIXME: Search for an existing framework? Under '%ProgramFiles(x86)%', // see 'Reference Assemblies\Microsoft\Framework\.NETFramework'. // Use a version installed by VS 2022 without a separate component. @@ -448,23 +448,23 @@ bool cmGlobalVisualStudioVersionedGenerator::MatchesGeneratorName( { std::string genName; switch (this->Version) { - case cmGlobalVisualStudioGenerator::VS9: - case cmGlobalVisualStudioGenerator::VS10: - case cmGlobalVisualStudioGenerator::VS11: - case cmGlobalVisualStudioGenerator::VS12: - case cmGlobalVisualStudioGenerator::VS14: + case cmGlobalVisualStudioGenerator::VSVersion::VS9: + case cmGlobalVisualStudioGenerator::VSVersion::VS10: + case cmGlobalVisualStudioGenerator::VSVersion::VS11: + case cmGlobalVisualStudioGenerator::VSVersion::VS12: + case cmGlobalVisualStudioGenerator::VSVersion::VS14: break; - case cmGlobalVisualStudioGenerator::VS15: + case cmGlobalVisualStudioGenerator::VSVersion::VS15: if (cmVS15GenName(name, genName)) { return genName == this->GetName(); } break; - case cmGlobalVisualStudioGenerator::VS16: + case cmGlobalVisualStudioGenerator::VSVersion::VS16: if (cmVS16GenName(name, genName)) { return genName == this->GetName(); } break; - case cmGlobalVisualStudioGenerator::VS17: + case cmGlobalVisualStudioGenerator::VSVersion::VS17: if (cmVS17GenName(name, genName)) { return genName == this->GetName(); } @@ -691,16 +691,16 @@ cmGlobalVisualStudioVersionedGenerator::GetAndroidApplicationTypeRevision() const { switch (this->Version) { - case cmGlobalVisualStudioGenerator::VS9: - case cmGlobalVisualStudioGenerator::VS10: - case cmGlobalVisualStudioGenerator::VS11: - case cmGlobalVisualStudioGenerator::VS12: + case cmGlobalVisualStudioGenerator::VSVersion::VS9: + case cmGlobalVisualStudioGenerator::VSVersion::VS10: + case cmGlobalVisualStudioGenerator::VSVersion::VS11: + case cmGlobalVisualStudioGenerator::VSVersion::VS12: return ""; - case cmGlobalVisualStudioGenerator::VS14: + case cmGlobalVisualStudioGenerator::VSVersion::VS14: return "2.0"; - case cmGlobalVisualStudioGenerator::VS15: - case cmGlobalVisualStudioGenerator::VS16: - case cmGlobalVisualStudioGenerator::VS17: + case cmGlobalVisualStudioGenerator::VSVersion::VS15: + case cmGlobalVisualStudioGenerator::VSVersion::VS16: + case cmGlobalVisualStudioGenerator::VSVersion::VS17: return "3.0"; } return ""; @@ -806,7 +806,7 @@ bool cmGlobalVisualStudioVersionedGenerator::InitializeWindows(cmMakefile* mf) // the target Windows version. if (this->IsWin81SDKInstalled()) { // VS 2019 does not default to 8.1 so specify it explicitly when needed. - if (this->Version >= cmGlobalVisualStudioGenerator::VS16 && + if (this->Version >= cmGlobalVisualStudioGenerator::VSVersion::VS16 && !cmSystemTools::VersionCompareGreater(this->SystemVersion, "8.1")) { this->SetWindowsTargetPlatformVersion("8.1", mf); return true; @@ -894,7 +894,7 @@ std::string cmGlobalVisualStudioVersionedGenerator::FindMSBuildCommand() // Ask Visual Studio Installer tool. std::string vs; if (vsSetupAPIHelper.GetVSInstanceInfo(vs)) { - if (this->Version >= cmGlobalVisualStudioGenerator::VS17) { + if (this->Version >= cmGlobalVisualStudioGenerator::VSVersion::VS17) { msbuild = vs + "/MSBuild/Current/Bin/amd64/MSBuild.exe"; if (cmSystemTools::FileExists(msbuild)) { return msbuild; diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 4bf8df6..ed7e888 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -198,8 +198,8 @@ void cmLocalVisualStudio7Generator::GenerateTarget(cmGeneratorTarget* target) // Intel Fortran for VS10 uses VS9 format ".vfproj" files. cmGlobalVisualStudioGenerator::VSVersion realVersion = gg->GetVersion(); if (this->FortranProject && - gg->GetVersion() >= cmGlobalVisualStudioGenerator::VS10) { - gg->SetVersion(cmGlobalVisualStudioGenerator::VS9); + gg->GetVersion() >= cmGlobalVisualStudioGenerator::VSVersion::VS10) { + gg->SetVersion(cmGlobalVisualStudioGenerator::VSVersion::VS9); } // add to the list of projects @@ -1106,7 +1106,8 @@ void cmLocalVisualStudio7Generator::OutputBuildTool( fout << "\t\t\t\tGenerateDebugInformation=\"true\"\n"; } if (this->WindowsCEProject) { - if (this->GetVersion() < cmGlobalVisualStudioGenerator::VS9) { + if (this->GetVersion() < + cmGlobalVisualStudioGenerator::VSVersion::VS9) { fout << "\t\t\t\tSubSystem=\"9\"\n"; } else { fout << "\t\t\t\tSubSystem=\"8\"\n"; @@ -1183,7 +1184,8 @@ void cmLocalVisualStudio7Generator::OutputBuildTool( fout << "\t\t\t\tGenerateDebugInformation=\"true\"\n"; } if (this->WindowsCEProject) { - if (this->GetVersion() < cmGlobalVisualStudioGenerator::VS9) { + if (this->GetVersion() < + cmGlobalVisualStudioGenerator::VSVersion::VS9) { fout << "\t\t\t\tSubSystem=\"9\"\n"; } else { fout << "\t\t\t\tSubSystem=\"8\"\n"; @@ -2026,7 +2028,8 @@ void cmLocalVisualStudio7Generator::WriteProjectStart( << "GetVersion() / 10) << ".00\"\n"; + fout << "\tVersion=\"" << (static_cast(gg->GetVersion()) / 10) + << ".00\"\n"; cmValue p = target->GetProperty("PROJECT_LABEL"); const std::string projLabel = p ? *p : libName; p = target->GetProperty("VS_KEYWORD"); diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 89011a2..f325994 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -419,7 +419,7 @@ void cmVisualStudio10TargetGenerator::Generate() if (this->ProjectType == VsProjectType::csproj && this->GeneratorTarget->IsDotNetSdkTarget() && this->GlobalGenerator->GetVersion() >= - cmGlobalVisualStudioGenerator::VS16) { + cmGlobalVisualStudioGenerator::VSVersion::VS16) { this->WriteSdkStyleProjectFile(BuildFileStream); } else { this->WriteClassicMsBuildProjectFile(BuildFileStream); @@ -446,7 +446,7 @@ void cmVisualStudio10TargetGenerator::WriteClassicMsBuildProjectFile( e0.Attribute("DefaultTargets", "Build"); const char* toolsVersion = this->GlobalGenerator->GetToolsVersion(); if (this->GlobalGenerator->GetVersion() == - cmGlobalVisualStudioGenerator::VS12 && + cmGlobalVisualStudioGenerator::VSVersion::VS12 && this->GlobalGenerator->TargetsWindowsCE()) { toolsVersion = "4.0"; } @@ -612,7 +612,7 @@ void cmVisualStudio10TargetGenerator::WriteClassicMsBuildProjectFile( // project using an older toolset version is opened in a newer version of // the IDE (respected by VS 2013 and above). if (this->GlobalGenerator->GetVersion() >= - cmGlobalVisualStudioGenerator::VS12) { + cmGlobalVisualStudioGenerator::VSVersion::VS12) { e1.Element("VCProjectUpgraderObjectName", "NoUpgrade"); } @@ -623,7 +623,7 @@ void cmVisualStudio10TargetGenerator::WriteClassicMsBuildProjectFile( if (this->Managed) { if (this->LocalGenerator->GetVersion() >= - cmGlobalVisualStudioGenerator::VS17) { + cmGlobalVisualStudioGenerator::VSVersion::VS17) { e1.Element("ManagedAssembly", "true"); } std::string outputType; @@ -1751,13 +1751,13 @@ void cmVisualStudio10TargetGenerator::WriteCustomRuleCpp( e2.WritePlatformConfigTag("AdditionalInputs", cond, additional_inputs); e2.WritePlatformConfigTag("Outputs", cond, outputs); if (this->LocalGenerator->GetVersion() > - cmGlobalVisualStudioGenerator::VS10) { + cmGlobalVisualStudioGenerator::VSVersion::VS10) { // VS >= 11 let us turn off linking of custom command outputs. e2.WritePlatformConfigTag("LinkObjects", cond, "false"); } if (symbolic && this->LocalGenerator->GetVersion() >= - cmGlobalVisualStudioGenerator::VS16) { + cmGlobalVisualStudioGenerator::VSVersion::VS16) { // VS >= 16.4 warn if outputs are not created, but one of our // outputs is marked SYMBOLIC and not expected to be created. e2.WritePlatformConfigTag("VerifyInputsAndOutputsExist", cond, "false"); @@ -2320,7 +2320,7 @@ void cmVisualStudio10TargetGenerator::WriteSource(Elem& e2, bool forceRelative = sf->GetLanguage() == "CUDA"; std::string sourceFile = this->ConvertPath(sf->GetFullPath(), forceRelative); if (this->LocalGenerator->GetVersion() == - cmGlobalVisualStudioGenerator::VS10 && + cmGlobalVisualStudioGenerator::VSVersion::VS10 && cmSystemTools::FileIsFullPath(sourceFile)) { // Normal path conversion resulted in a full path. VS 10 (but not 11) // refuses to show the property page in the IDE for a source file with a @@ -2418,7 +2418,7 @@ void cmVisualStudio10TargetGenerator::WriteAllSources(Elem& e0) case cmGeneratorTarget::SourceKindExternalObject: tool = "Object"; if (this->LocalGenerator->GetVersion() < - cmGlobalVisualStudioGenerator::VS11) { + cmGlobalVisualStudioGenerator::VSVersion::VS11) { // For VS == 10 we cannot use LinkObjects to avoid linking custom // command outputs. If an object file is generated in this target, // then vs10 will use it in the build, and we have to list it as @@ -3106,7 +3106,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( if (this->ProjectType == VsProjectType::vcxproj) { clOptions.FixExceptionHandlingDefault(); if (this->GlobalGenerator->GetVersion() >= - cmGlobalVisualStudioGenerator::VS15) { + cmGlobalVisualStudioGenerator::VSVersion::VS15) { // Toolsets that come with VS 2017 may now enable UseFullPaths // by default and there is no negative /FC option that projects // can use to switch it back. Older toolsets disable this by diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index e495db0..5c17a07 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -75,13 +75,13 @@ void cmVisualStudioGeneratorOptions::FixExceptionHandlingDefault() // the flag to disable exception handling. When the user does // remove the flag we need to override the IDE default of on. switch (this->Version) { - case cmGlobalVisualStudioGenerator::VS10: - case cmGlobalVisualStudioGenerator::VS11: - case cmGlobalVisualStudioGenerator::VS12: - case cmGlobalVisualStudioGenerator::VS14: - case cmGlobalVisualStudioGenerator::VS15: - case cmGlobalVisualStudioGenerator::VS16: - case cmGlobalVisualStudioGenerator::VS17: + case cmGlobalVisualStudioGenerator::VSVersion::VS10: + case cmGlobalVisualStudioGenerator::VSVersion::VS11: + case cmGlobalVisualStudioGenerator::VSVersion::VS12: + case cmGlobalVisualStudioGenerator::VSVersion::VS14: + case cmGlobalVisualStudioGenerator::VSVersion::VS15: + case cmGlobalVisualStudioGenerator::VSVersion::VS16: + case cmGlobalVisualStudioGenerator::VSVersion::VS17: // by default VS puts empty // for a project, to make our projects look the same put a new line // and space over for the closing as the default @@ -108,7 +108,8 @@ void cmVisualStudioGeneratorOptions::SetVerboseMakefile(bool verbose) if (verbose && this->FlagMap.find("SuppressStartupBanner") == this->FlagMap.end()) { this->FlagMap["SuppressStartupBanner"] = - this->Version < cmGlobalVisualStudioGenerator::VS10 ? "FALSE" : ""; + this->Version < cmGlobalVisualStudioGenerator::VSVersion::VS10 ? "FALSE" + : ""; } } @@ -425,7 +426,7 @@ void cmVisualStudioGeneratorOptions::OutputPreprocessorDefinitions( } std::ostringstream oss; - if (this->Version >= cmGlobalVisualStudioGenerator::VS10) { + if (this->Version >= cmGlobalVisualStudioGenerator::VSVersion::VS10) { oss << "%(" << tag << ")"; } std::vector::const_iterator de = @@ -433,13 +434,13 @@ void cmVisualStudioGeneratorOptions::OutputPreprocessorDefinitions( for (std::string const& di : cmMakeRange(this->Defines.cbegin(), de)) { // Escape the definition for the compiler. std::string define; - if (this->Version < cmGlobalVisualStudioGenerator::VS10) { + if (this->Version < cmGlobalVisualStudioGenerator::VSVersion::VS10) { define = this->LocalGenerator->EscapeForShell(di, true); } else { define = di; } // Escape this flag for the MSBuild. - if (this->Version >= cmGlobalVisualStudioGenerator::VS10) { + if (this->Version >= cmGlobalVisualStudioGenerator::VSVersion::VS10) { cmVS10EscapeForMSBuild(define); if (lang == "RC") { cmSystemTools::ReplaceString(define, "\"", "\\\""); @@ -481,7 +482,7 @@ void cmVisualStudioGeneratorOptions::OutputAdditionalIncludeDirectories( } // Escape this include for the MSBuild. - if (this->Version >= cmGlobalVisualStudioGenerator::VS10) { + if (this->Version >= cmGlobalVisualStudioGenerator::VSVersion::VS10) { cmVS10EscapeForMSBuild(include); } oss << sep << include; @@ -493,7 +494,7 @@ void cmVisualStudioGeneratorOptions::OutputAdditionalIncludeDirectories( } } - if (this->Version >= cmGlobalVisualStudioGenerator::VS10) { + if (this->Version >= cmGlobalVisualStudioGenerator::VSVersion::VS10) { oss << sep << "%(" << tag << ")"; } @@ -507,7 +508,7 @@ void cmVisualStudioGeneratorOptions::OutputFlagMap(std::ostream& fout, std::ostringstream oss; const char* sep = ""; for (std::string i : m.second) { - if (this->Version >= cmGlobalVisualStudioGenerator::VS10) { + if (this->Version >= cmGlobalVisualStudioGenerator::VSVersion::VS10) { cmVS10EscapeForMSBuild(i); } oss << sep << i; -- cgit v0.12