MCPcopy Create free account
hub / github.com/Kitware/CMake / WriteProjectReferences

Method WriteProjectReferences

Source/cmVisualStudio10TargetGenerator.cxx:5125–5170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5123}
5124
5125void cmVisualStudio10TargetGenerator::WriteProjectReferences(Elem& e0)
5126{
5127 cmGlobalGenerator::TargetDependSet const& unordered =
5128 this->GlobalGenerator->GetTargetDirectDepends(this->GeneratorTarget);
5129 using OrderedTargetDependSet =
5130 cmGlobalVisualStudioGenerator::OrderedTargetDependSet;
5131 OrderedTargetDependSet depends(unordered, CMAKE_CHECK_BUILD_SYSTEM_TARGET);
5132 Elem e1(e0, "ItemGroup");
5133 e1.SetHasElements();
5134 for (cmGeneratorTarget const* dt : depends) {
5135 if (!dt->IsInBuildSystem()) {
5136 continue;
5137 }
5138 // skip fortran targets as they can not be processed by MSBuild
5139 // the only reference will be in the .sln file
5140 if (this->GlobalGenerator->TargetIsFortranOnly(dt)) {
5141 continue;
5142 }
5143 cmLocalGenerator* lg = dt->GetLocalGenerator();
5144 std::string name = dt->GetName();
5145 std::string path;
5146 if (cmValue p = dt->GetProperty("EXTERNAL_MSPROJECT")) {
5147 path = *p;
5148 } else {
5149 path = cmStrCat(lg->GetCurrentBinaryDirectory(), '/', dt->GetName(),
5150 computeProjectFileExtension(dt));
5151 }
5152 ConvertToWindowsSlash(path);
5153 Elem e2(e1, "ProjectReference");
5154 e2.Attribute("Include", path);
5155 e2.Element("Project",
5156 cmStrCat('{', this->GlobalGenerator->GetGUID(name), '}'));
5157 e2.Element("Name", name);
5158 this->WriteDotNetReferenceCustomTags(e2, name);
5159 if (dt->IsCSharpOnly() || cmHasLiteralSuffix(path, "csproj")) {
5160 e2.Element("SkipGetTargetFrameworkProperties", "true");
5161 }
5162 // Don't reference targets that don't produce any output.
5163 else if (this->Configurations.empty() ||
5164 dt->GetManagedType(this->Configurations[0]) ==
5165 cmGeneratorTarget::ManagedType::Undefined) {
5166 e2.Element("ReferenceOutputAssembly", "false");
5167 e2.Element("CopyToOutputDirectory", "Never");
5168 }
5169 }
5170}
5171
5172void cmVisualStudio10TargetGenerator::WritePlatformExtensions(Elem& e1)
5173{

Callers 2

Calls 15

ConvertToWindowsSlashFunction · 0.85
cmHasLiteralSuffixFunction · 0.85
SetHasElementsMethod · 0.80
IsInBuildSystemMethod · 0.80
TargetIsFortranOnlyMethod · 0.80
AttributeMethod · 0.80
IsCSharpOnlyMethod · 0.80
GetManagedTypeMethod · 0.80
cmStrCatFunction · 0.70

Tested by

no test coverage detected