| 399 | } |
| 400 | |
| 401 | cmValue cmSourceFile::GetProperty(std::string const& prop) const |
| 402 | { |
| 403 | // Check for computed properties. |
| 404 | if (prop == propLOCATION) { |
| 405 | if (this->FullPath.empty()) { |
| 406 | return nullptr; |
| 407 | } |
| 408 | return cmValue(this->FullPath); |
| 409 | } |
| 410 | |
| 411 | // Check for the properties with backtraces. |
| 412 | if (prop == propINCLUDE_DIRECTORIES) { |
| 413 | if (this->IncludeDirectories.empty()) { |
| 414 | return nullptr; |
| 415 | } |
| 416 | |
| 417 | static std::string output; |
| 418 | output = cmList::to_string(this->IncludeDirectories); |
| 419 | return cmValue(output); |
| 420 | } |
| 421 | |
| 422 | if (prop == propCOMPILE_OPTIONS) { |
| 423 | if (this->CompileOptions.empty()) { |
| 424 | return nullptr; |
| 425 | } |
| 426 | |
| 427 | static std::string output; |
| 428 | output = cmList::to_string(this->CompileOptions); |
| 429 | return cmValue(output); |
| 430 | } |
| 431 | |
| 432 | if (prop == propCOMPILE_DEFINITIONS) { |
| 433 | if (this->CompileDefinitions.empty()) { |
| 434 | return nullptr; |
| 435 | } |
| 436 | |
| 437 | static std::string output; |
| 438 | output = cmList::to_string(this->CompileDefinitions); |
| 439 | return cmValue(output); |
| 440 | } |
| 441 | |
| 442 | cmValue retVal = this->Properties.GetPropertyValue(prop); |
| 443 | if (!retVal) { |
| 444 | cmMakefile const* mf = this->Location.GetMakefile(); |
| 445 | bool const chain = |
| 446 | mf->GetState()->IsPropertyChained(prop, cmProperty::SOURCE_FILE); |
| 447 | if (chain) { |
| 448 | return mf->GetProperty(prop, chain); |
| 449 | } |
| 450 | return nullptr; |
| 451 | } |
| 452 | |
| 453 | return retVal; |
| 454 | } |
| 455 | |
| 456 | std::string const& cmSourceFile::GetSafeProperty(std::string const& prop) const |
| 457 | { |
no test coverage detected