mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-25 00:59:19 -06:00
Vs: factor out computation of <Link> tag for CSharp source files
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user