diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 325357d48..cb52e1529 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -6219,15 +6219,18 @@ void cmTarget::GetTransitivePropertyTargets(const std::string& config, cmTarget const* headTarget, std::vector &tgts) const { - cmTarget::LinkInterface const* iface - = this->GetLinkInterfaceLibraries(config, headTarget, false); - if (!iface) - { - return; - } - if(this->GetType() != STATIC_LIBRARY - || this->GetPolicyStatusCMP0022() == cmPolicies::WARN - || this->GetPolicyStatusCMP0022() == cmPolicies::OLD) + // The $ expression may be in a link interface to specify private + // link dependencies that are otherwise excluded from usage requirements. + // Currently $ is internal to CMake and only ever added by + // target_link_libraries for PRIVATE dependencies of STATIC libraries in + // INTERFACE_LINK_LIBRARIES which is used under CMP0022 NEW behavior. + bool usage_requirements_only = + this->GetType() == STATIC_LIBRARY && + this->GetPolicyStatusCMP0022() != cmPolicies::WARN && + this->GetPolicyStatusCMP0022() != cmPolicies::OLD; + if(cmTarget::LinkInterface const* iface = + this->GetLinkInterfaceLibraries(config, headTarget, + usage_requirements_only)) { for(std::vector::const_iterator it = iface->Libraries.begin(); it != iface->Libraries.end(); ++it) @@ -6237,29 +6240,6 @@ void cmTarget::GetTransitivePropertyTargets(const std::string& config, tgts.push_back(it->Target); } } - return; - } - - const char* linkIfaceProp = "INTERFACE_LINK_LIBRARIES"; - const char* interfaceLibs = this->GetProperty(linkIfaceProp); - - if (!interfaceLibs) - { - return; - } - - // The interface libraries have been explicitly set. - std::vector libs; - this->ExpandLinkItems(linkIfaceProp, interfaceLibs, config, - headTarget, true, libs); - - for(std::vector::const_iterator it = libs.begin(); - it != libs.end(); ++it) - { - if (it->Target) - { - tgts.push_back(it->Target); - } } }