summaryrefslogtreecommitdiffstats
path: root/Source/cmVisualStudio10TargetGenerator.cxx
diff options
context:
space:
mode:
authorKinan Mahdi <kmahdi@allplan.com>2021-04-29 15:35:04 (GMT)
committerBrad King <brad.king@kitware.com>2021-05-03 15:25:42 (GMT)
commit31bbcd19055eddef68560b61b6f977dd6f0f17ff (patch)
treeaa05aa9e7b22690ed5b58b273f81a546e2582253 /Source/cmVisualStudio10TargetGenerator.cxx
parent4e5893b658b1c360c1b2d9413dbd66b2b02dbacc (diff)
downloadCMake-31bbcd19055eddef68560b61b6f977dd6f0f17ff.zip
CMake-31bbcd19055eddef68560b61b6f977dd6f0f17ff.tar.gz
CMake-31bbcd19055eddef68560b61b6f977dd6f0f17ff.tar.bz2
VS: Fix CSharp sources inside build directory
Fixes: #22104
Diffstat (limited to 'Source/cmVisualStudio10TargetGenerator.cxx')
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx7
1 files changed, 5 insertions, 2 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 0255d60..cc1586d 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -5037,7 +5037,9 @@ std::string cmVisualStudio10TargetGenerator::GetCSharpSourceLink(
{
// For out of source files, we first check if a matching source group
// 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
+ // source- or binary-dir is used within the link and return that.
+ // In case of .cs files we can't do that automatically for files in the
+ // binary directory, because this leads to compilation errors.
std::string link;
std::string sourceGroupedFile;
std::string const& fullFileName = source->GetFullPath();
@@ -5059,7 +5061,8 @@ std::string cmVisualStudio10TargetGenerator::GetCSharpSourceLink(
link = sourceGroupedFile;
} else if (cmHasPrefix(fullFileName, srcDir)) {
link = fullFileName.substr(srcDir.length() + 1);
- } else if (cmHasPrefix(fullFileName, binDir)) {
+ } else if (!cmHasSuffix(fullFileName, ".cs") &&
+ cmHasPrefix(fullFileName, binDir)) {
link = fullFileName.substr(binDir.length() + 1);
} else if (cmProp l = source->GetProperty("VS_CSHARP_Link")) {
link = *l;