From 0682cd36571e8a3c78c6425e9a56647880d8d28b Mon Sep 17 00:00:00 2001 From: Sumit Bhardwaj Date: Fri, 24 Dec 2021 00:22:29 -0800 Subject: VS: Add proj as a project type to VsProjectType Add `proj` as a project type to VsProjectType so that it can be consumed by `ZERO_CHECK` target. This commit adds the type and cleans up the code that needs to treat `proj` and `csproj` in the same fashion. Next commit will make changes to add `ZERO_CHECK.proj`. --- Source/cmLocalVisualStudioGenerator.cxx | 2 +- Source/cmVisualStudio10TargetGenerator.cxx | 15 +++++++++++++++ Source/cmVsProjectType.h | 3 ++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index 93f01ed..2703c7b 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/Source/cmLocalVisualStudioGenerator.cxx @@ -252,7 +252,7 @@ std::string cmLocalVisualStudioGenerator::FinishConstructScript( // Store the script in a string. std::string script; - if (useLocal && projectType == VsProjectType::csproj) { + if (useLocal && projectType != VsProjectType::vcxproj) { // This label is not provided by MSBuild for C# projects. script += newline; script += this->GetReportErrorLabel(); diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index a79337b..1eb55f9 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -248,6 +248,8 @@ static std::string computeProjectFileExtension(VsProjectType projectType) switch (projectType) { case VsProjectType::csproj: return ".csproj"; + case VsProjectType::proj: + return ".proj"; default: return ".vcxproj"; } @@ -681,6 +683,8 @@ void cmVisualStudio10TargetGenerator::WriteClassicMsBuildProjectFile( .Attribute("Project", VS10_CSharp_DEFAULT_PROPS) .Attribute("Condition", "Exists('" VS10_CSharp_DEFAULT_PROPS "')"); break; + default: + break; } this->WriteProjectConfigurationValues(e0); @@ -737,6 +741,8 @@ void cmVisualStudio10TargetGenerator::WriteClassicMsBuildProjectFile( case VsProjectType::csproj: props = VS10_CSharp_USER_PROPS; break; + default: + break; } if (cmValue p = this->GeneratorTarget->GetProperty("VS_USER_PROPS")) { props = *p; @@ -779,6 +785,8 @@ void cmVisualStudio10TargetGenerator::WriteClassicMsBuildProjectFile( Elem(e0, "Import").Attribute("Project", VS10_CSharp_TARGETS); } break; + default: + break; } this->WriteTargetSpecificReferences(e0); @@ -3057,6 +3065,8 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( cm::make_unique(this->LocalGenerator, Options::CSharpCompiler, gg->GetCSharpFlagTable()); break; + default: + break; } Options& clOptions = *pOptions; @@ -3182,6 +3192,8 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( return def.find('=') != std::string::npos; }); break; + default: + break; } clOptions.AddDefines(targetDefines); @@ -4308,6 +4320,9 @@ void cmVisualStudio10TargetGenerator::AddLibraries( this->AdditionalUsingDirectories[config].insert( cmSystemTools::GetFilenamePath(location)); break; + default: + // In .proj files, we wouldn't be referencing libraries. + break; } } } diff --git a/Source/cmVsProjectType.h b/Source/cmVsProjectType.h index 8899267..04053a0 100644 --- a/Source/cmVsProjectType.h +++ b/Source/cmVsProjectType.h @@ -7,5 +7,6 @@ enum class VsProjectType { vcxproj, - csproj + csproj, + proj, }; -- cgit v0.12