Merge topic 'csharp-link-file'

8a6107650e VS: Only link cs files when they're not in binary dir

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Michael Stürmer <michael.stuermer@schaeffler.com>
Merge-request: !2177
This commit is contained in:
Brad King
2018-07-09 11:33:28 +00:00
committed by Kitware Robot

View File

@@ -4565,14 +4565,17 @@ void cmVisualStudio10TargetGenerator::WriteCSharpSourceProperties(
void cmVisualStudio10TargetGenerator::GetCSharpSourceLink(
cmSourceFile const* sf, std::string& link)
{
std::string f = sf->GetFullPath();
if (!this->InSourceBuild) {
std::string const& sourceFilePath = sf->GetFullPath();
std::string const& binaryDir = LocalGenerator->GetCurrentBinaryDirectory();
if (!cmSystemTools::IsSubDirectory(sourceFilePath, binaryDir)) {
const std::string stripFromPath =
this->Makefile->GetCurrentSourceDirectory();
if (f.find(stripFromPath) != std::string::npos) {
link = f.substr(stripFromPath.length() + 1);
if (sourceFilePath.find(stripFromPath) == 0) {
if (const char* l = sf->GetProperty("VS_CSHARP_Link")) {
link = l;
} else {
link = sourceFilePath.substr(stripFromPath.length() + 1);
}
ConvertToWindowsSlash(link);
}