diff options
author | Brad King <brad.king@kitware.com> | 2020-10-06 10:47:10 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-10-06 10:47:19 (GMT) |
commit | c814172e846ca74298ba2baaf100d0a07d871bc4 (patch) | |
tree | 59994b1a1d0043424d6098e8fab90df7c409b8ed /Source/cmVisualStudio10TargetGenerator.cxx | |
parent | bac0e0adb6fa5f2b8980dd9a34a3d08760b07e45 (diff) | |
parent | 8d87cfdbf34671ad80cf584456dfdb565007f869 (diff) | |
download | CMake-c814172e846ca74298ba2baaf100d0a07d871bc4.zip CMake-c814172e846ca74298ba2baaf100d0a07d871bc4.tar.gz CMake-c814172e846ca74298ba2baaf100d0a07d871bc4.tar.bz2 |
Merge topic 'csharp-source_group-bugfix'
8d87cfdbf3 VS: Fix regression in C# source links
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5314
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 413166e..0becee2 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -4996,6 +4996,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(); @@ -5005,8 +5006,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)) { |