| 119 | } |
| 120 | |
| 121 | bool cmTargetPropCommandBase::ProcessContentArgs( |
| 122 | std::vector<std::string> const& args, unsigned int& argIndex, bool prepend, |
| 123 | bool system) |
| 124 | { |
| 125 | std::string const& scope = args[argIndex]; |
| 126 | |
| 127 | if (scope != "PUBLIC" && scope != "PRIVATE" && scope != "INTERFACE") { |
| 128 | this->SetError("called with invalid arguments"); |
| 129 | return false; |
| 130 | } |
| 131 | |
| 132 | ++argIndex; |
| 133 | |
| 134 | std::vector<std::string> content; |
| 135 | |
| 136 | for (unsigned int i = argIndex; i < args.size(); ++i, ++argIndex) { |
| 137 | if (args[i] == "PUBLIC" || args[i] == "PRIVATE" || |
| 138 | args[i] == "INTERFACE") { |
| 139 | break; |
| 140 | } |
| 141 | content.push_back(args[i]); |
| 142 | } |
| 143 | if (!content.empty()) { |
| 144 | if (this->Target->GetType() == cmStateEnums::INTERFACE_LIBRARY && |
| 145 | scope != "INTERFACE" && this->Property != "SOURCES") { |
| 146 | this->SetError("may only set INTERFACE properties on INTERFACE targets"); |
| 147 | return false; |
| 148 | } |
| 149 | if (this->Target->IsImported() && scope != "INTERFACE") { |
| 150 | this->SetError("may only set INTERFACE properties on IMPORTED targets"); |
| 151 | return false; |
| 152 | } |
| 153 | if (this->Target->GetType() == cmStateEnums::UTILITY && |
| 154 | scope != "PRIVATE") { |
| 155 | this->SetError("may only set PRIVATE properties on custom targets"); |
| 156 | return false; |
| 157 | } |
| 158 | } |
| 159 | return this->PopulateTargetProperties(scope, content, prepend, system); |
| 160 | } |
| 161 | |
| 162 | bool cmTargetPropCommandBase::PopulateTargetProperties( |
| 163 | std::string const& scope, std::vector<std::string> const& content, |
no test coverage detected