| 4812 | } |
| 4813 | |
| 4814 | void cmVisualStudio10TargetGenerator::AddLibraries( |
| 4815 | cmComputeLinkInformation const& cli, std::vector<std::string>& libVec, |
| 4816 | std::vector<std::string>& vsTargetVec, std::string const& config) |
| 4817 | { |
| 4818 | using ItemVector = cmComputeLinkInformation::ItemVector; |
| 4819 | ItemVector const& libs = cli.GetItems(); |
| 4820 | for (cmComputeLinkInformation::Item const& l : libs) { |
| 4821 | if (l.Target) { |
| 4822 | auto managedType = l.Target->GetManagedType(config); |
| 4823 | if (managedType != cmGeneratorTarget::ManagedType::Native && |
| 4824 | this->GeneratorTarget->GetManagedType(config) != |
| 4825 | cmGeneratorTarget::ManagedType::Native && |
| 4826 | l.Target->IsImported() && |
| 4827 | l.Target->GetType() != cmStateEnums::INTERFACE_LIBRARY) { |
| 4828 | auto location = l.Target->GetFullPath(config); |
| 4829 | if (!location.empty()) { |
| 4830 | ConvertToWindowsSlash(location); |
| 4831 | switch (this->ProjectType) { |
| 4832 | case VsProjectType::csproj: |
| 4833 | // If the target we want to "link" to is an imported managed |
| 4834 | // target and this is a C# project, we add a hint reference. This |
| 4835 | // reference is written to project file in |
| 4836 | // WriteDotNetReferences(). |
| 4837 | this->DotNetHintReferences[config].push_back( |
| 4838 | DotNetHintReference(l.Target->GetName(), location)); |
| 4839 | break; |
| 4840 | case VsProjectType::vcxproj: |
| 4841 | // Add path of assembly to list of using-directories, so the |
| 4842 | // managed assembly can be used by '#using <assembly.dll>' in |
| 4843 | // code. |
| 4844 | this->AdditionalUsingDirectories[config].insert( |
| 4845 | cmSystemTools::GetFilenamePath(location)); |
| 4846 | break; |
| 4847 | default: |
| 4848 | // In .proj files, we wouldn't be referencing libraries. |
| 4849 | break; |
| 4850 | } |
| 4851 | } |
| 4852 | } |
| 4853 | // Do not allow C# targets to be added to the LIB listing. LIB files are |
| 4854 | // used for linking C++ dependencies. C# libraries do not have lib files. |
| 4855 | // Instead, they compile down to C# reference libraries (DLL files). The |
| 4856 | // `<ProjectReference>` elements added to the vcxproj are enough for the |
| 4857 | // IDE to deduce the DLL file required by other C# projects that need its |
| 4858 | // reference library. |
| 4859 | if (managedType == cmGeneratorTarget::ManagedType::Managed) { |
| 4860 | continue; |
| 4861 | } |
| 4862 | } |
| 4863 | |
| 4864 | if (l.IsPath == cmComputeLinkInformation::ItemIsPath::Yes) { |
| 4865 | std::string path = |
| 4866 | this->LocalGenerator->MaybeRelativeToCurBinDir(l.Value.Value); |
| 4867 | ConvertToWindowsSlash(path); |
| 4868 | if (cmVS10IsTargetsFile(l.Value.Value)) { |
| 4869 | vsTargetVec.push_back(path); |
| 4870 | } else { |
| 4871 | libVec.push_back(l.HasFeature() ? l.GetFormattedItem(path).Value |
no test coverage detected