diff options
author | Kinan Mahdi <kinan.mahdi@gmail.com> | 2020-10-02 16:56:01 +0200 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-10-05 12:49:14 -0400 |
commit | 8d87cfdbf34671ad80cf584456dfdb565007f869 (patch) | |
tree | ec5d4aba9a7e8c42f227dbf39e5b1a0783e39ccd /Source/cmVisualStudio10TargetGenerator.cxx | |
parent | 177fc020731bcee747295573c92cd0f7ca200e53 (diff) | |
download | cmake-8d87cfdbf34671ad80cf584456dfdb565007f869.tar.gz |
VS: Fix regression in C# source links
Fix logic used since commit ac6b18cd90 (CSharp: Add support for source
groups with out-of-source builds, 2020-02-18, v3.18.0-rc1~645^2).
Add a check of the physical file location for C# source groups.
Diffstat (limited to 'Source/cmVisualStudio10TargetGenerator.cxx')
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index a8e424d606..f58c6fd717 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -4927,6 +4927,7 @@ std::string cmVisualStudio10TargetGenerator::GetCSharpSourceLink( // for this file exists, otherwise we check if the path relative to current // source- or binary-dir is used within the link and return that std::string link; + std::string sourceGroupedFile; std::string const& fullFileName = source->GetFullPath(); std::string const& srcDir = this->Makefile->GetCurrentSourceDirectory(); std::string const& binDir = this->Makefile->GetCurrentBinaryDirectory(); @@ -4936,8 +4937,14 @@ std::string cmVisualStudio10TargetGenerator::GetCSharpSourceLink( cmSourceGroup* sourceGroup = this->Makefile->FindSourceGroup(fullFileName, sourceGroups); if (sourceGroup && !sourceGroup->GetFullName().empty()) { - link = sourceGroup->GetFullName() + "/" + + sourceGroupedFile = sourceGroup->GetFullName() + "/" + cmsys::SystemTools::GetFilenameName(fullFileName); + cmsys::SystemTools::ConvertToUnixSlashes(sourceGroupedFile); + } + + if (!sourceGroupedFile.empty() && + cmHasSuffix(fullFileName, sourceGroupedFile)) { + link = sourceGroupedFile; } else if (cmHasPrefix(fullFileName, srcDir)) { link = fullFileName.substr(srcDir.length() + 1); } else if (cmHasPrefix(fullFileName, binDir)) { |