| 41 | } |
| 42 | |
| 43 | void cmExportAndroidMKGenerator::GenerateInterfaceProperties( |
| 44 | cmGeneratorTarget const* target, std::ostream& os, |
| 45 | ImportPropertyMap const& properties) |
| 46 | { |
| 47 | std::string const config = |
| 48 | (this->Configurations.empty() ? std::string{} : this->Configurations[0]); |
| 49 | GenerateType const type = this->GetGenerateType(); |
| 50 | |
| 51 | if (!properties.empty()) { |
| 52 | os << "LOCAL_CPP_FEATURES := rtti exceptions\n"; |
| 53 | for (auto const& property : properties) { |
| 54 | if (property.first == "INTERFACE_COMPILE_OPTIONS") { |
| 55 | os << "LOCAL_CPP_FEATURES += "; |
| 56 | os << (property.second) << "\n"; |
| 57 | } else if (property.first == "INTERFACE_LINK_LIBRARIES") { |
| 58 | std::string staticLibs; |
| 59 | std::string sharedLibs; |
| 60 | std::string ldlibs; |
| 61 | cmLinkInterfaceLibraries const* linkIFace = |
| 62 | target->GetLinkInterfaceLibraries(config, target, |
| 63 | cmGeneratorTarget::UseTo::Link); |
| 64 | for (cmLinkItem const& item : linkIFace->Libraries) { |
| 65 | cmGeneratorTarget const* gt = item.Target; |
| 66 | std::string const& lib = item.AsStr(); |
| 67 | if (gt) { |
| 68 | |
| 69 | if (gt->GetType() == cmStateEnums::SHARED_LIBRARY || |
| 70 | gt->GetType() == cmStateEnums::MODULE_LIBRARY) { |
| 71 | sharedLibs = cmStrCat(std::move(sharedLibs), ' ', lib); |
| 72 | } else { |
| 73 | staticLibs = cmStrCat(std::move(staticLibs), ' ', lib); |
| 74 | } |
| 75 | } else { |
| 76 | bool relpath = false; |
| 77 | if (type == INSTALL) { |
| 78 | relpath = cmHasLiteralPrefix(lib, "../"); |
| 79 | } |
| 80 | // check for full path or if it already has a -l, or |
| 81 | // in the case of an install check for relative paths |
| 82 | // if it is full or a link library then use string directly |
| 83 | if (cmSystemTools::FileIsFullPath(lib) || |
| 84 | cmHasLiteralPrefix(lib, "-l") || relpath) { |
| 85 | ldlibs = cmStrCat(std::move(ldlibs), ' ', lib); |
| 86 | // if it is not a path and does not have a -l then add -l |
| 87 | } else if (!lib.empty()) { |
| 88 | ldlibs = cmStrCat(std::move(ldlibs), " -l", lib); |
| 89 | } |
| 90 | } |
| 91 | } |
| 92 | if (!sharedLibs.empty()) { |
| 93 | os << "LOCAL_SHARED_LIBRARIES :=" << sharedLibs << "\n"; |
| 94 | } |
| 95 | if (!staticLibs.empty()) { |
| 96 | os << "LOCAL_STATIC_LIBRARIES :=" << staticLibs << "\n"; |
| 97 | } |
| 98 | if (!ldlibs.empty()) { |
| 99 | os << "LOCAL_EXPORT_LDLIBS :=" << ldlibs << "\n"; |
| 100 | } |
no test coverage detected