| 21 | } |
| 22 | |
| 23 | bool cmTargetPropCommandBase::HandleArguments( |
| 24 | std::vector<std::string> const& args, std::string const& prop, |
| 25 | unsigned int flags) |
| 26 | { |
| 27 | if (args.size() < 2) { |
| 28 | this->SetError("called with incorrect number of arguments"); |
| 29 | return false; |
| 30 | } |
| 31 | |
| 32 | if (this->Makefile->IsAlias(args[0])) { |
| 33 | this->SetError("can not be used on an ALIAS target."); |
| 34 | return false; |
| 35 | } |
| 36 | // Lookup the target for which property-values are specified. |
| 37 | this->Target = this->Makefile->GetGlobalGenerator()->FindTarget(args[0]); |
| 38 | if (!this->Target) { |
| 39 | this->Target = this->Makefile->FindTargetToUse(args[0]); |
| 40 | } |
| 41 | if (!this->Target) { |
| 42 | this->HandleMissingTarget(args[0]); |
| 43 | return false; |
| 44 | } |
| 45 | if (this->Target->IsSymbolic()) { |
| 46 | this->SetError("can not be used on a SYMBOLIC target."); |
| 47 | return false; |
| 48 | } |
| 49 | bool const isRegularTarget = |
| 50 | (this->Target->GetType() == cmStateEnums::EXECUTABLE) || |
| 51 | (this->Target->GetType() == cmStateEnums::STATIC_LIBRARY) || |
| 52 | (this->Target->GetType() == cmStateEnums::SHARED_LIBRARY) || |
| 53 | (this->Target->GetType() == cmStateEnums::MODULE_LIBRARY) || |
| 54 | (this->Target->GetType() == cmStateEnums::OBJECT_LIBRARY) || |
| 55 | (this->Target->GetType() == cmStateEnums::INTERFACE_LIBRARY) || |
| 56 | (this->Target->GetType() == cmStateEnums::UNKNOWN_LIBRARY); |
| 57 | bool const isCustomTarget = this->Target->GetType() == cmStateEnums::UTILITY; |
| 58 | |
| 59 | if (prop == "SOURCES") { |
| 60 | if (!isRegularTarget && !isCustomTarget) { |
| 61 | this->SetError("called with non-compilable target type"); |
| 62 | return false; |
| 63 | } |
| 64 | } else { |
| 65 | if (!isRegularTarget) { |
| 66 | this->SetError("called with non-compilable target type"); |
| 67 | return false; |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | bool system = false; |
| 72 | unsigned int argIndex = 1; |
| 73 | |
| 74 | if ((flags & PROCESS_SYSTEM) && args[argIndex] == "SYSTEM") { |
| 75 | if (args.size() < 3) { |
| 76 | this->SetError("called with incorrect number of arguments"); |
| 77 | return false; |
| 78 | } |
| 79 | system = true; |
| 80 | ++argIndex; |
no test coverage detected