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

Method GetCSharpSourceLink

Source/cmVisualStudio10TargetGenerator.cxx:6024–6060  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6022}
6023
6024std::string cmVisualStudio10TargetGenerator::GetCSharpSourceLink(
6025 cmSourceFile const* source)
6026{
6027 // For out of source files, we first check if a matching source group
6028 // for this file exists, otherwise we check if the path relative to current
6029 // source- or binary-dir is used within the link and return that.
6030 // In case of .cs files we can't do that automatically for files in the
6031 // binary directory, because this leads to compilation errors.
6032 std::string link;
6033 std::string sourceGroupedFile;
6034 std::string const& fullFileName = source->GetFullPath();
6035 std::string const& srcDir = this->Makefile->GetCurrentSourceDirectory();
6036 std::string const& binDir = this->Makefile->GetCurrentBinaryDirectory();
6037 cmSourceGroup const* sourceGroup =
6038 this->LocalGenerator->FindSourceGroup(fullFileName);
6039 if (sourceGroup && !sourceGroup->GetFullName().empty()) {
6040 sourceGroupedFile =
6041 cmStrCat(sourceGroup->GetFullName(), '/',
6042 cmsys::SystemTools::GetFilenameName(fullFileName));
6043 cmsys::SystemTools::ConvertToUnixSlashes(sourceGroupedFile);
6044 }
6045
6046 if (!sourceGroupedFile.empty() &&
6047 cmHasSuffix(fullFileName, sourceGroupedFile)) {
6048 link = sourceGroupedFile;
6049 } else if (cmHasPrefix(fullFileName, srcDir)) {
6050 link = fullFileName.substr(srcDir.length() + 1);
6051 } else if (!cmHasSuffix(fullFileName, ".cs") &&
6052 cmHasPrefix(fullFileName, binDir)) {
6053 link = fullFileName.substr(binDir.length() + 1);
6054 } else if (cmValue l = source->GetProperty("VS_CSHARP_Link")) {
6055 link = *l;
6056 }
6057
6058 ConvertToWindowsSlash(link);
6059 return link;
6060}
6061
6062std::string cmVisualStudio10TargetGenerator::GetCMakeFilePath(
6063 char const* relativeFilePath) const

Callers 2

WriteSourceMethod · 0.95

Calls 11

cmHasSuffixFunction · 0.85
cmHasPrefixFunction · 0.85
ConvertToWindowsSlashFunction · 0.85
lengthMethod · 0.80
cmStrCatFunction · 0.70
GetFullPathMethod · 0.45
FindSourceGroupMethod · 0.45
emptyMethod · 0.45
GetFullNameMethod · 0.45
substrMethod · 0.45
GetPropertyMethod · 0.45

Tested by

no test coverage detected