| 2491 | } |
| 2492 | |
| 2493 | void 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 | |
| 2528 | void cmVisualStudio10TargetGenerator::WriteAllSources(Elem& e0) |
| 2529 | { |
no test coverage detected