| 3870 | } |
| 3871 | |
| 3872 | cmTarget* cmMakefile::FindTargetToUse( |
| 3873 | std::string const& name, cmStateEnums::TargetDomainSet domains) const |
| 3874 | { |
| 3875 | // Look for an imported target. These take priority because they |
| 3876 | // are more local in scope and do not have to be globally unique. |
| 3877 | auto targetName = name; |
| 3878 | if (domains.contains(cmStateEnums::TargetDomain::ALIAS)) { |
| 3879 | // Look for local alias targets. |
| 3880 | auto alias = this->AliasTargets.find(name); |
| 3881 | if (alias != this->AliasTargets.end()) { |
| 3882 | targetName = alias->second; |
| 3883 | } |
| 3884 | } |
| 3885 | auto const imported = this->ImportedTargets.find(targetName); |
| 3886 | |
| 3887 | bool const useForeign = |
| 3888 | domains.contains(cmStateEnums::TargetDomain::FOREIGN); |
| 3889 | bool const useNative = domains.contains(cmStateEnums::TargetDomain::NATIVE); |
| 3890 | |
| 3891 | if (imported != this->ImportedTargets.end()) { |
| 3892 | if (imported->second->IsForeign() ? useForeign : useNative) { |
| 3893 | return imported->second; |
| 3894 | } |
| 3895 | } |
| 3896 | |
| 3897 | // Look for a target built in this directory. |
| 3898 | if (cmTarget* t = this->FindLocalNonAliasTarget(name)) { |
| 3899 | if (t->IsForeign() ? useForeign : useNative) { |
| 3900 | return t; |
| 3901 | } |
| 3902 | } |
| 3903 | |
| 3904 | // Look for a target built in this project. |
| 3905 | return this->GetGlobalGenerator()->FindTarget(name, domains); |
| 3906 | } |
| 3907 | |
| 3908 | bool cmMakefile::IsAlias(std::string const& name) const |
| 3909 | { |
no test coverage detected