diff options
author | Michael Stürmer <michael.stuermer@schaeffler.com> | 2018-03-20 11:19:13 (GMT) |
---|---|---|
committer | Michael Stürmer <michael.stuermer@schaeffler.com> | 2018-04-23 05:31:23 (GMT) |
commit | 16fec7e2fc454a9fe64ac7ffa03a6d8adcc1320d (patch) | |
tree | 8a8b1e73261f6fedfb1eab386109c825e88df0a3 /Source | |
parent | f3c6828876f2f0dd8408868d90db1c4b323cba02 (diff) | |
download | CMake-16fec7e2fc454a9fe64ac7ffa03a6d8adcc1320d.zip CMake-16fec7e2fc454a9fe64ac7ffa03a6d8adcc1320d.tar.gz CMake-16fec7e2fc454a9fe64ac7ffa03a6d8adcc1320d.tar.bz2 |
cmVisualStudio10TargetGenerator: make some methods config aware
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 26 | ||||
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.h | 8 |
2 files changed, 22 insertions, 12 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 4dabb4c..ef03ca5 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -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 diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index 3c53d1b..b6107d1 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -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); |