MCPcopy Create free account
hub / github.com/Kitware/CMake / HandleDirectoryMode

Function HandleDirectoryMode

Source/cmSetPropertyCommand.cxx:663–707  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

661}
662
663bool 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
709bool HandleTargetMode(cmExecutionStatus& status,
710 std::set<std::string> const& names,

Callers 1

cmSetPropertyCommandFunction · 0.70

Calls 9

FindMakefileMethod · 0.80
sizeMethod · 0.45
SetErrorMethod · 0.45
GetMakefileMethod · 0.45
emptyMethod · 0.45
beginMethod · 0.45
GetGlobalGeneratorMethod · 0.45
AppendPropertyMethod · 0.45
SetPropertyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…