| 661 | } |
| 662 | |
| 663 | bool HandleDirectoryMode(cmExecutionStatus& status, |
| 664 | std::set<std::string> const& names, |
| 665 | std::string const& propertyName, |
| 666 | std::string const& propertyValue, bool appendAsString, |
| 667 | bool appendMode, bool remove) |
| 668 | { |
| 669 | if (names.size() > 1) { |
| 670 | status.SetError("allows at most one name for DIRECTORY scope."); |
| 671 | return false; |
| 672 | } |
| 673 | |
| 674 | // Default to the current directory. |
| 675 | cmMakefile* mf = &status.GetMakefile(); |
| 676 | |
| 677 | // Lookup the directory if given. |
| 678 | if (!names.empty()) { |
| 679 | // Construct the directory name. Interpret relative paths with |
| 680 | // respect to the current directory. |
| 681 | std::string dir = cmSystemTools::CollapseFullPath( |
| 682 | *names.begin(), status.GetMakefile().GetCurrentSourceDirectory()); |
| 683 | |
| 684 | mf = status.GetMakefile().GetGlobalGenerator()->FindMakefile(dir); |
| 685 | if (!mf) { |
| 686 | // Could not find the directory. |
| 687 | status.SetError( |
| 688 | "DIRECTORY scope provided but requested directory was not found. " |
| 689 | "This could be because the directory argument was invalid or, " |
| 690 | "it is valid but has not been processed yet."); |
| 691 | return false; |
| 692 | } |
| 693 | } |
| 694 | |
| 695 | // Set or append the property. |
| 696 | if (appendMode) { |
| 697 | mf->AppendProperty(propertyName, propertyValue, appendAsString); |
| 698 | } else { |
| 699 | if (remove) { |
| 700 | mf->SetProperty(propertyName, nullptr); |
| 701 | } else { |
| 702 | mf->SetProperty(propertyName, propertyValue); |
| 703 | } |
| 704 | } |
| 705 | |
| 706 | return true; |
| 707 | } |
| 708 | |
| 709 | bool HandleTargetMode(cmExecutionStatus& status, |
| 710 | std::set<std::string> const& names, |
no test coverage detected
searching dependent graphs…