MCPcopy Create free account
hub / github.com/Kitware/CMake / ComputeImportInfo

Method ComputeImportInfo

Source/cmGeneratorTarget.cxx:4780–4929  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4778}
4779
4780void cmGeneratorTarget::ComputeImportInfo(std::string const& desired_config,
4781 ImportInfo& info) const
4782{
4783 // This method finds information about an imported target from its
4784 // properties. The "IMPORTED_" namespace is reserved for properties
4785 // defined by the project exporting the target.
4786
4787 // Initialize members.
4788 info.NoSOName = false;
4789
4790 cmValue loc = nullptr;
4791 cmValue imp = nullptr;
4792 std::string suffix;
4793 if (!this->Target->GetMappedConfig(desired_config, loc, imp, suffix)) {
4794 return;
4795 }
4796
4797 // Get the link interface.
4798 {
4799 // Use the INTERFACE_LINK_LIBRARIES special representation directly
4800 // to get backtraces.
4801 cmBTStringRange entries = this->Target->GetLinkInterfaceEntries();
4802 if (!entries.empty()) {
4803 info.LibrariesProp = "INTERFACE_LINK_LIBRARIES";
4804 for (BT<std::string> const& entry : entries) {
4805 info.Libraries.emplace_back(entry);
4806 }
4807 } else if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
4808 std::string linkProp =
4809 cmStrCat("IMPORTED_LINK_INTERFACE_LIBRARIES", suffix);
4810 cmValue propertyLibs = this->GetProperty(linkProp);
4811 if (!propertyLibs) {
4812 linkProp = "IMPORTED_LINK_INTERFACE_LIBRARIES";
4813 propertyLibs = this->GetProperty(linkProp);
4814 }
4815 if (propertyLibs) {
4816 info.LibrariesProp = linkProp;
4817 info.Libraries.emplace_back(*propertyLibs);
4818 }
4819 }
4820 }
4821 for (BT<std::string> const& entry :
4822 this->Target->GetLinkInterfaceDirectEntries()) {
4823 info.LibrariesHeadInclude.emplace_back(entry);
4824 }
4825 for (BT<std::string> const& entry :
4826 this->Target->GetLinkInterfaceDirectExcludeEntries()) {
4827 info.LibrariesHeadExclude.emplace_back(entry);
4828 }
4829 if (this->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
4830 if (loc) {
4831 info.LibName = *loc;
4832 }
4833 return;
4834 }
4835
4836 // A provided configuration has been chosen. Load the
4837 // configuration's properties.

Callers 1

GetImportInfoMethod · 0.95

Calls 14

GetTypeMethod · 0.95
GetPropertyMethod · 0.95
CheckManagedTypeMethod · 0.95
GetMappedConfigMethod · 0.80
emplace_backMethod · 0.80
c_strMethod · 0.80
cmStrCatFunction · 0.70

Tested by

no test coverage detected