1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-19 11:18:40 +08:00

cmVisualStudio10TargetGenerator: make some methods config aware

This commit is contained in:
Michael Stürmer
2018-03-20 12:19:13 +01:00
parent f3c6828876
commit 16fec7e2fc
2 changed files with 22 additions and 12 deletions

View File

@@ -711,21 +711,29 @@ void cmVisualStudio10TargetGenerator::WriteDotNetReferences()
ConvertToWindowsSlash(path);
hintReferences.push_back(HintReference(name, path));
} else {
this->WriteDotNetReference(ri, "");
this->WriteDotNetReference(ri, "", "");
}
}
for (const auto& i : hintReferences) {
this->WriteDotNetReference(i.first, i.second);
this->WriteDotNetReference(i.first, i.second, "");
}
this->WriteString("</ItemGroup>\n", 1);
}
}
void cmVisualStudio10TargetGenerator::WriteDotNetReference(
std::string const& ref, std::string const& hint)
std::string const& ref, std::string const& hint, std::string const& config)
{
this->WriteString("<Reference Include=\"", 2);
(*this->BuildFileStream) << cmVS10EscapeAttr(ref) << "\">\n";
std::string attr = " Include=\"" + cmVS10EscapeAttr(ref) + "\"";
// If 'config' is not empty, the reference is only added for the given
// configuration. This is used when referencing imported managed assemblies.
// See also cmVisualStudio10TargetGenerator::AddLibraries().
if (!config.empty()) {
this->WritePlatformConfigTag("Reference", config, 2, attr.c_str());
} else {
this->WriteString("<Reference ", 2);
(*this->BuildFileStream) << attr << ">\n";
}
this->WriteElem("CopyLocalSatelliteAssemblies", "true", 3);
this->WriteElem("ReferenceOutputAssembly", "true", 3);
if (!hint.empty()) {
@@ -3262,7 +3270,7 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions(
std::vector<std::string> libVec;
std::vector<std::string> vsTargetVec;
this->AddLibraries(cli, libVec, vsTargetVec);
this->AddLibraries(cli, libVec, vsTargetVec, config);
if (std::find(linkClosure->Languages.begin(), linkClosure->Languages.end(),
"CUDA") != linkClosure->Languages.end()) {
switch (this->CudaOptions[config]->GetCudaRuntime()) {
@@ -3478,8 +3486,8 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions(
}
void cmVisualStudio10TargetGenerator::AddLibraries(
cmComputeLinkInformation& cli, std::vector<std::string>& libVec,
std::vector<std::string>& vsTargetVec)
const cmComputeLinkInformation& cli, std::vector<std::string>& libVec,
std::vector<std::string>& vsTargetVec, const std::string& config)
{
typedef cmComputeLinkInformation::ItemVector ItemVector;
ItemVector const& libs = cli.GetItems();
@@ -3487,7 +3495,7 @@ void cmVisualStudio10TargetGenerator::AddLibraries(
this->LocalGenerator->GetCurrentBinaryDirectory();
for (cmComputeLinkInformation::Item const& l : libs) {
if (l.Target) {
auto managedType = l.Target->GetManagedType("");
auto managedType = l.Target->GetManagedType(config);
// Do not allow C# targets to be added to the LIB listing. LIB files are
// used for linking C++ dependencies. C# libraries do not have lib files.
// Instead, they compile down to C# reference libraries (DLL files). The

View File

@@ -72,7 +72,8 @@ private:
std::vector<size_t> const& exclude_configs);
void WriteAllSources();
void WriteDotNetReferences();
void WriteDotNetReference(std::string const& ref, std::string const& hint);
void WriteDotNetReference(std::string const& ref, std::string const& hint,
std::string const& config);
void WriteDotNetReferenceCustomTags(std::string const& ref);
void WriteEmbeddedResourceGroup();
void WriteWinRTReferences();
@@ -147,9 +148,10 @@ private:
void WriteProjectReferences();
void WriteApplicationTypeSettings();
void OutputSourceSpecificFlags(Elem&, cmSourceFile const* source);
void AddLibraries(cmComputeLinkInformation& cli,
void AddLibraries(const cmComputeLinkInformation& cli,
std::vector<std::string>& libVec,
std::vector<std::string>& vsTargetVec);
std::vector<std::string>& vsTargetVec,
const std::string& config);
void AddTargetsFileAndConfigPair(std::string const& targetsFile,
std::string const& config);
void WriteLibOptions(std::string const& config);