Vs: factor out computation of <Link> tag for CSharp source files

This commit is contained in:
Michael Stürmer
2017-06-17 09:32:19 +02:00
parent 0a8f469af9
commit dcdab5cf23
2 changed files with 22 additions and 8 deletions

View File

@@ -2056,14 +2056,10 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
typedef std::map<std::string, std::string> CsPropMap;
CsPropMap sourceFileTags;
// set <Link> tag if necessary
if (!this->InSourceBuild) {
const std::string stripFromPath =
this->Makefile->GetCurrentSourceDirectory();
if (f.find(stripFromPath) != std::string::npos) {
std::string link = f.substr(stripFromPath.length() + 1);
this->ConvertToWindowsSlash(link);
sourceFileTags["Link"] = link;
}
std::string link;
this->GetCSharpSourceLink(source, link);
if (!link.empty()) {
sourceFileTags["Link"] = link;
}
this->GetCSharpSourceProperties(&sf, sourceFileTags);
// write source file specific tags
@@ -4380,6 +4376,23 @@ void cmVisualStudio10TargetGenerator::WriteCSharpSourceProperties(
}
}
void cmVisualStudio10TargetGenerator::GetCSharpSourceLink(
cmSourceFile const* sf, std::string& link)
{
std::string f = sf->GetFullPath();
if (!this->InSourceBuild) {
const std::string stripFromPath =
this->Makefile->GetCurrentSourceDirectory();
if (f.find(stripFromPath) != std::string::npos) {
link = f.substr(stripFromPath.length() + 1);
if (const char* l = sf->GetProperty("VS_CSHARP_Link")) {
link = l;
}
this->ConvertToWindowsSlash(link);
}
}
}
std::string cmVisualStudio10TargetGenerator::GetCMakeFilePath(
const char* relativeFilePath) const
{

View File

@@ -162,6 +162,7 @@ private:
std::map<std::string, std::string>& tags);
void WriteCSharpSourceProperties(
const std::map<std::string, std::string>& tags);
void GetCSharpSourceLink(cmSourceFile const* sf, std::string& link);
private:
typedef cmVisualStudioGeneratorOptions Options;