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`.
pipelines/267959
Sumit Bhardwaj 2021-12-24 00:22:29 -08:00 committed by Brad King
parent 6ab2c40c17
commit 0682cd3657
3 changed files with 18 additions and 2 deletions

View File

@ -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();

View File

@ -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<Options>(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;
}
}
}

View File

@ -7,5 +7,6 @@
enum class VsProjectType
{
vcxproj,
csproj
csproj,
proj,
};