diff options
author | Robert Dailey <robert@ziosk.com> | 2018-06-29 20:30:59 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-07-06 13:45:15 (GMT) |
commit | 8a6107650e60b0ca2b9dfdad4b86d1b2f57bbfd7 (patch) | |
tree | 9f364819e00ea41b1bce96622090be1f1505c6ea /Source/cmVisualStudio10TargetGenerator.cxx | |
parent | 39851a6d43c40078c7f6d479c49e29e9a4842f1a (diff) | |
download | CMake-8a6107650e60b0ca2b9dfdad4b86d1b2f57bbfd7.zip CMake-8a6107650e60b0ca2b9dfdad4b86d1b2f57bbfd7.tar.gz CMake-8a6107650e60b0ca2b9dfdad4b86d1b2f57bbfd7.tar.bz2 |
VS: Only link cs files when they're not in binary dir
When `*.cs` files are provided, do not generate a `<Link>` element in
the `.csproj` project if those files are descendants of
`CMAKE_CURRENT_BINARY_DIR`. This comparison happens for each file.
Diffstat (limited to 'Source/cmVisualStudio10TargetGenerator.cxx')
-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); } |