| 2084 | } |
| 2085 | |
| 2086 | void cmTarget::SetProperty(std::string const& prop, cmValue value) |
| 2087 | { |
| 2088 | if (!IsSettableProperty(this->impl->Makefile, this, prop)) { |
| 2089 | return; |
| 2090 | } |
| 2091 | |
| 2092 | UsageRequirementProperty* usageRequirements[] = { |
| 2093 | &this->impl->IncludeDirectories, |
| 2094 | &this->impl->CompileOptions, |
| 2095 | &this->impl->CompileFeatures, |
| 2096 | &this->impl->CompileDefinitions, |
| 2097 | &this->impl->PrecompileHeaders, |
| 2098 | &this->impl->Sources, |
| 2099 | &this->impl->LinkOptions, |
| 2100 | &this->impl->LinkDirectories, |
| 2101 | &this->impl->LinkLibraries, |
| 2102 | &this->impl->InterfaceLinkLibraries, |
| 2103 | &this->impl->InterfaceLinkLibrariesDirect, |
| 2104 | &this->impl->InterfaceLinkLibrariesDirectExclude, |
| 2105 | &this->impl->ImportedCxxModulesIncludeDirectories, |
| 2106 | &this->impl->ImportedCxxModulesCompileDefinitions, |
| 2107 | &this->impl->ImportedCxxModulesCompileFeatures, |
| 2108 | &this->impl->ImportedCxxModulesCompileOptions, |
| 2109 | &this->impl->ImportedCxxModulesLinkLibraries, |
| 2110 | }; |
| 2111 | |
| 2112 | for (auto* usageRequirement : usageRequirements) { |
| 2113 | if (usageRequirement->Write(this->impl.get(), {}, prop, value, |
| 2114 | UsageRequirementProperty::Action::Set)) { |
| 2115 | return; |
| 2116 | } |
| 2117 | } |
| 2118 | |
| 2119 | FileSetType* fileSetTypes[] = { |
| 2120 | &this->impl->HeadersFileSets, |
| 2121 | &this->impl->CxxModulesFileSets, |
| 2122 | }; |
| 2123 | |
| 2124 | for (auto* fileSetType : fileSetTypes) { |
| 2125 | if (fileSetType->WriteProperties(this, this->impl.get(), prop, value, |
| 2126 | FileSetType::Action::Set)) { |
| 2127 | return; |
| 2128 | } |
| 2129 | } |
| 2130 | |
| 2131 | if (prop == propIMPORTED_GLOBAL) { |
| 2132 | if (!value.IsOn()) { |
| 2133 | std::ostringstream e; |
| 2134 | e << "IMPORTED_GLOBAL property can't be set to FALSE on targets (\"" |
| 2135 | << this->impl->Name << "\")\n"; |
| 2136 | this->impl->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str()); |
| 2137 | return; |
| 2138 | } |
| 2139 | /* no need to change anything if value does not change */ |
| 2140 | if (!this->IsImportedGloballyVisible()) { |
| 2141 | this->impl->TargetVisibility = Visibility::ImportedGlobally; |
| 2142 | this->GetGlobalGenerator()->IndexTarget(this); |
| 2143 | } |
no test coverage detected