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

Method WriteSource

Source/cmVisualStudio10TargetGenerator.cxx:2493–2526  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2491}
2492
2493void cmVisualStudio10TargetGenerator::WriteSource(Elem& e2,
2494 cmSourceFile const* sf)
2495{
2496 // Visual Studio tools append relative paths to the current dir, as in:
2497 //
2498 // c:\path\to\current\dir\..\..\..\relative\path\to\source.c
2499 //
2500 // and fail if this exceeds the maximum allowed path length. Our path
2501 // conversion uses full paths when possible to allow deeper trees.
2502 // However, CUDA 8.0 msbuild rules fail on absolute paths so for CUDA
2503 // we must use relative paths.
2504 bool forceRelative = sf->GetLanguage() == "CUDA"_s;
2505 std::string sourceFile = this->ConvertPath(sf->GetFullPath(), forceRelative);
2506 ConvertToWindowsSlash(sourceFile);
2507 e2.Attribute("Include", sourceFile);
2508
2509 if (this->ProjectType == VsProjectType::csproj && !this->InSourceBuild) {
2510 // For out of source projects we have to provide a link (if not specified
2511 // via property) for every source file (besides .cs files) otherwise they
2512 // will not be visible in VS at all.
2513 // First we check if the file is in a source group, then we check if the
2514 // file path is relative to current source- or binary-dir, otherwise it is
2515 // added with the plain filename without any path. This means the file will
2516 // show up at root-level of the csproj (where CMakeLists.txt etc. are).
2517 std::string link = this->GetCSharpSourceLink(sf);
2518 if (link.empty()) {
2519 link = cmsys::SystemTools::GetFilenameName(sf->GetFullPath());
2520 }
2521 e2.Element("Link", link);
2522 }
2523
2524 ToolSource toolSource = { sf, forceRelative };
2525 this->Tools[e2.Tag].push_back(toolSource);
2526}
2527
2528void cmVisualStudio10TargetGenerator::WriteAllSources(Elem& e0)
2529{

Callers 5

WriteXamlFilesGroupMethod · 0.95
WriteCustomRuleMethod · 0.95
WriteHeaderSourceMethod · 0.95
WriteExtraSourceMethod · 0.95
WriteAllSourcesMethod · 0.95

Calls 9

ConvertPathMethod · 0.95
GetCSharpSourceLinkMethod · 0.95
ConvertToWindowsSlashFunction · 0.85
GetLanguageMethod · 0.80
AttributeMethod · 0.80
push_backMethod · 0.80
GetFullPathMethod · 0.45
emptyMethod · 0.45
ElementMethod · 0.45

Tested by

no test coverage detected