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

Function HandleGlobImpl

Source/cmFileCommand.cxx:665–822  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

663}
664
665bool HandleGlobImpl(std::vector<std::string> const& args, bool recurse,
666 cmExecutionStatus& status)
667{
668 if (args.size() < 2) {
669 status.SetError(cmStrCat(
670 args[0], " must be called with at least one additional argument."));
671 return false;
672 }
673
674 auto i = args.begin();
675
676 i++; // Get rid of subcommand
677
678 std::string variable = *i;
679 i++;
680 cmsys::Glob g;
681 g.SetRecurse(recurse);
682 if (recurse) {
683 g.RecurseThroughSymlinksOff();
684 }
685
686 cmake* cm = status.GetMakefile().GetCMakeInstance();
687 std::vector<std::string> files;
688 bool configureDepends = false;
689 bool warnConfigureLate = false;
690 while (i != args.end()) {
691 if (*i == "LIST_DIRECTORIES") {
692 ++i; // skip LIST_DIRECTORIES
693 if (i != args.end()) {
694 if (cmIsOn(*i)) {
695 g.SetListDirs(true);
696 g.SetRecurseListDirs(true);
697 } else if (cmIsOff(*i)) {
698 g.SetListDirs(false);
699 g.SetRecurseListDirs(false);
700 } else {
701 status.SetError("LIST_DIRECTORIES missing bool value.");
702 return false;
703 }
704 ++i;
705 } else {
706 status.SetError("LIST_DIRECTORIES missing bool value.");
707 return false;
708 }
709 } else if (*i == "FOLLOW_SYMLINKS") {
710 ++i; // skip FOLLOW_SYMLINKS
711 if (recurse) {
712 g.RecurseThroughSymlinksOn();
713 if (i == args.end()) {
714 status.SetError(
715 "GLOB_RECURSE requires a glob expression after FOLLOW_SYMLINKS.");
716 return false;
717 }
718 }
719 } else if (*i == "RELATIVE") {
720 ++i; // skip RELATIVE
721 if (i == args.end()) {
722 status.SetError("GLOB requires a directory after the RELATIVE tag.");

Callers 2

HandleGlobCommandFunction · 0.85
HandleGlobRecurseCommandFunction · 0.85

Calls 15

cmIsOnFunction · 0.85
cmIsOffFunction · 0.85
appendFunction · 0.85
to_stringFunction · 0.85
SetRelativeMethod · 0.80
c_strMethod · 0.80
GetRoleMethod · 0.80
FindFilesMethod · 0.80
GetDebugOutputMethod · 0.80
GetTraceMethod · 0.80
eraseMethod · 0.80
GetRelativeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…