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

Function HandleLockCommand

Source/cmFileCommand.cxx:2941–3100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2939}
2940
2941bool HandleLockCommand(std::vector<std::string> const& args,
2942 cmExecutionStatus& status)
2943{
2944#if !defined(CMAKE_BOOTSTRAP)
2945 // Default values
2946 bool directory = false;
2947 bool release = false;
2948 enum Guard
2949 {
2950 GUARD_FUNCTION,
2951 GUARD_FILE,
2952 GUARD_PROCESS
2953 };
2954 Guard guard = GUARD_PROCESS;
2955 std::string resultVariable;
2956 unsigned long timeout = static_cast<unsigned long>(-1);
2957
2958 // Parse arguments
2959 if (args.size() < 2) {
2960 status.GetMakefile().IssueMessage(
2961 MessageType::FATAL_ERROR,
2962 "sub-command LOCK requires at least two arguments.");
2963 return false;
2964 }
2965
2966 std::string path = args[1];
2967 for (unsigned i = 2; i < args.size(); ++i) {
2968 if (args[i] == "DIRECTORY") {
2969 directory = true;
2970 } else if (args[i] == "RELEASE") {
2971 release = true;
2972 } else if (args[i] == "GUARD") {
2973 ++i;
2974 char const* merr = "expected FUNCTION, FILE or PROCESS after GUARD";
2975 if (i >= args.size()) {
2976 status.GetMakefile().IssueMessage(MessageType::FATAL_ERROR, merr);
2977 return false;
2978 }
2979 if (args[i] == "FUNCTION") {
2980 guard = GUARD_FUNCTION;
2981 } else if (args[i] == "FILE") {
2982 guard = GUARD_FILE;
2983 } else if (args[i] == "PROCESS") {
2984 guard = GUARD_PROCESS;
2985 } else {
2986 status.GetMakefile().IssueMessage(
2987 MessageType::FATAL_ERROR,
2988 cmStrCat(merr, ", but got:\n \"", args[i], "\"."));
2989 return false;
2990 }
2991
2992 } else if (args[i] == "RESULT_VARIABLE") {
2993 ++i;
2994 if (i >= args.size()) {
2995 status.GetMakefile().IssueMessage(
2996 MessageType::FATAL_ERROR,
2997 "expected variable name after RESULT_VARIABLE");
2998 return false;

Callers

nothing calls this directly

Calls 15

cmStrToLongFunction · 0.85
LockFunctionScopeMethod · 0.80
LockFileScopeMethod · 0.80
LockProcessScopeMethod · 0.80
GetOutputMessageMethod · 0.80
IsOkMethod · 0.80
cmStrCatFunction · 0.70
sizeMethod · 0.45
IssueMessageMethod · 0.45
GetMakefileMethod · 0.45
GetGlobalGeneratorMethod · 0.45
ReleaseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…