Commit 8a610765 authored by Robert Dailey's avatar Robert Dailey Committed by Brad King

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.
parent 39851a6d
Pipeline #108765 passed with stage
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment