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

Method WriteClassicMsBuildProjectFile

Source/cmVisualStudio10TargetGenerator.cxx:487–912  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

485}
486
487void cmVisualStudio10TargetGenerator::WriteClassicMsBuildProjectFile(
488 cmGeneratedFileStream& BuildFileStream)
489{
490 BuildFileStream << R"(<?xml version="1.0" encoding=")"
491 << this->GlobalGenerator->Encoding() << "\"?>";
492 {
493 Elem e0(BuildFileStream, "Project");
494 e0.Attribute("DefaultTargets", "Build");
495 char const* toolsVersion = this->GlobalGenerator->GetToolsVersion();
496 e0.Attribute("ToolsVersion", toolsVersion);
497 e0.Attribute("xmlns",
498 "http://schemas.microsoft.com/developer/msbuild/2003");
499
500 if (this->NsightTegra) {
501 Elem e1(e0, "PropertyGroup");
502 e1.Attribute("Label", "NsightTegraProject");
503 unsigned int const nsightTegraMajorVersion = this->NsightTegraVersion[0];
504 unsigned int const nsightTegraMinorVersion = this->NsightTegraVersion[1];
505 if (nsightTegraMajorVersion >= 2) {
506 if (nsightTegraMajorVersion > 3 ||
507 (nsightTegraMajorVersion == 3 && nsightTegraMinorVersion >= 1)) {
508 e1.Element("NsightTegraProjectRevisionNumber", "11");
509 } else {
510 // Nsight Tegra 2.0 uses project revision 9.
511 e1.Element("NsightTegraProjectRevisionNumber", "9");
512 }
513 // Tell newer versions to upgrade silently when loading.
514 e1.Element("NsightTegraUpgradeOnceWithoutPrompt", "true");
515 } else {
516 // Require Nsight Tegra 1.6 for JCompile support.
517 e1.Element("NsightTegraProjectRevisionNumber", "7");
518 }
519 }
520
521 if (char const* hostArch =
522 this->GlobalGenerator->GetPlatformToolsetHostArchitecture()) {
523 Elem e1(e0, "PropertyGroup");
524 e1.Element("PreferredToolArchitecture", hostArch);
525 }
526
527 // The ALL_BUILD, PACKAGE, and ZERO_CHECK projects transitively include
528 // Microsoft.Common.CurrentVersion.targets which triggers Target
529 // ResolveNugetPackageAssets when SDK-style targets are in the project.
530 // However, these projects have no nuget packages to reference and the
531 // build fails.
532 // Setting ResolveNugetPackages to false skips this target and the build
533 // succeeds.
534 cm::string_view targetName{ this->GeneratorTarget->GetName() };
535 if (targetName == "ALL_BUILD"_s || targetName == "PACKAGE"_s ||
536 targetName == CMAKE_CHECK_BUILD_SYSTEM_TARGET) {
537 Elem e1(e0, "PropertyGroup");
538 e1.Element("ResolveNugetPackages", "false");
539 }
540
541 if (this->ProjectType != VsProjectType::csproj) {
542 this->WriteProjectConfigurations(e0);
543 }
544

Callers 1

GenerateMethod · 0.95

Tested by

no test coverage detected