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

Function cmLoadCacheCommand

Source/cmLoadCacheCommand.cxx:23–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21 char const* line);
22
23bool cmLoadCacheCommand(std::vector<std::string> const& args,
24 cmExecutionStatus& status)
25{
26 if (args.empty()) {
27 status.SetError("called with wrong number of arguments.");
28 return false;
29 }
30
31 if (args.size() >= 2 && args[1] == "READ_WITH_PREFIX") {
32 return ReadWithPrefix(args, status);
33 }
34
35 cmState::Role const role =
36 status.GetMakefile().GetCMakeInstance()->GetState()->GetRole();
37 if (role != cmState::Role::Project) {
38 status.SetError(
39 "Only load_cache(READ_WITH_PREFIX) may be used in script mode");
40 return false;
41 }
42
43 // Cache entries to be excluded from the import list.
44 // If this set is empty, all cache entries are brought in
45 // and they can not be overridden.
46 bool excludeFiles = false;
47 std::set<std::string> excludes;
48
49 for (std::string const& arg : args) {
50 if (excludeFiles) {
51 excludes.insert(arg);
52 }
53 if (arg == "EXCLUDE") {
54 excludeFiles = true;
55 }
56 if (excludeFiles && (arg == "INCLUDE_INTERNALS")) {
57 break;
58 }
59 }
60
61 // Internal cache entries to be imported.
62 // If this set is empty, no internal cache entries are
63 // brought in.
64 bool includeFiles = false;
65 std::set<std::string> includes;
66
67 for (std::string const& arg : args) {
68 if (includeFiles) {
69 includes.insert(arg);
70 }
71 if (arg == "INCLUDE_INTERNALS") {
72 includeFiles = true;
73 }
74 if (includeFiles && (arg == "EXCLUDE")) {
75 break;
76 }
77 }
78
79 cmMakefile& mf = status.GetMakefile();
80

Callers

nothing calls this directly

Calls 10

ReadWithPrefixFunction · 0.85
GetRoleMethod · 0.80
emptyMethod · 0.45
SetErrorMethod · 0.45
sizeMethod · 0.45
GetStateMethod · 0.45
GetCMakeInstanceMethod · 0.45
GetMakefileMethod · 0.45
insertMethod · 0.45
LoadCacheMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…