diff options
author | Brad King <brad.king@kitware.com> | 2018-07-09 11:32:35 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-07-09 11:32:35 (GMT) |
commit | 855dafdda090b182c966415b5fc2e0a515fbb701 (patch) | |
tree | 607509a215f58fd0f4b85e2fed0eb2976afa7b3c /Source | |
parent | 0f3d7a1398f943b2417b317fa28c4a7cd5f7c6de (diff) | |
parent | 8a6107650e60b0ca2b9dfdad4b86d1b2f57bbfd7 (diff) | |
download | CMake-855dafdda090b182c966415b5fc2e0a515fbb701.zip CMake-855dafdda090b182c966415b5fc2e0a515fbb701.tar.gz CMake-855dafdda090b182c966415b5fc2e0a515fbb701.tar.bz2 |
Merge branch 'csharp-link-file' into release-3.12
Merge-request: !2177
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index b9ec301..eff915b 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -4523,14 +4523,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); } |