| 2005 | } |
| 2006 | |
| 2007 | bool isReadOnly(std::string const& prop, cmMakefile* context, |
| 2008 | cmTarget* target) const |
| 2009 | { |
| 2010 | auto importedTarget = target->IsImported(); |
| 2011 | bool matchingCondition = true; |
| 2012 | if ((!importedTarget && this->Condition == ReadOnlyCondition::Imported) || |
| 2013 | (importedTarget && |
| 2014 | this->Condition == ReadOnlyCondition::NonImported)) { |
| 2015 | matchingCondition = false; |
| 2016 | } |
| 2017 | if (!matchingCondition) { |
| 2018 | // Not read-only in this scenario |
| 2019 | return false; |
| 2020 | } |
| 2021 | |
| 2022 | bool readOnly = true; |
| 2023 | if (!this->Policy) { |
| 2024 | // No policy associated, so is always read-only |
| 2025 | context->IssueMessage(MessageType::FATAL_ERROR, |
| 2026 | this->message(prop, target)); |
| 2027 | } else { |
| 2028 | switch (target->GetPolicyStatus(*this->Policy)) { |
| 2029 | case cmPolicies::WARN: |
| 2030 | context->IssueMessage( |
| 2031 | MessageType::AUTHOR_WARNING, |
| 2032 | cmPolicies::GetPolicyWarning(cmPolicies::CMP0160) + "\n" + |
| 2033 | this->message(prop, target)); |
| 2034 | CM_FALLTHROUGH; |
| 2035 | case cmPolicies::OLD: |
| 2036 | readOnly = false; |
| 2037 | break; |
| 2038 | case cmPolicies::NEW: |
| 2039 | context->IssueMessage(MessageType::FATAL_ERROR, |
| 2040 | this->message(prop, target)); |
| 2041 | break; |
| 2042 | } |
| 2043 | } |
| 2044 | return readOnly; |
| 2045 | } |
| 2046 | }; |
| 2047 | |
| 2048 | bool IsSettableProperty(cmMakefile* context, cmTarget* target, |
no test coverage detected