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

Function cmIncludeDirectoryCommand

Source/cmIncludeDirectoryCommand.cxx:22–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20static void NormalizeInclude(cmMakefile& mf, std::string& inc);
21
22bool cmIncludeDirectoryCommand(std::vector<std::string> const& args,
23 cmExecutionStatus& status)
24{
25 if (args.empty()) {
26 return true;
27 }
28
29 cmMakefile& mf = status.GetMakefile();
30
31 auto i = args.begin();
32
33 bool before = mf.IsOn("CMAKE_INCLUDE_DIRECTORIES_BEFORE");
34 bool system = false;
35
36 if ((*i) == "BEFORE") {
37 before = true;
38 ++i;
39 } else if ((*i) == "AFTER") {
40 before = false;
41 ++i;
42 }
43
44 std::vector<std::string> beforeIncludes;
45 std::vector<std::string> afterIncludes;
46 std::set<std::string> systemIncludes;
47
48 for (; i != args.end(); ++i) {
49 if (*i == "SYSTEM") {
50 system = true;
51 continue;
52 }
53 if (i->empty()) {
54 status.SetError("given empty-string as include directory.");
55 return false;
56 }
57
58 std::vector<std::string> includes;
59
60 GetIncludes(mf, *i, includes);
61
62 if (before) {
63 cm::append(beforeIncludes, includes);
64 } else {
65 cm::append(afterIncludes, includes);
66 }
67 if (system) {
68 systemIncludes.insert(includes.begin(), includes.end());
69 }
70 }
71 std::reverse(beforeIncludes.begin(), beforeIncludes.end());
72
73 mf.AddIncludeDirectories(afterIncludes);
74 mf.AddIncludeDirectories(beforeIncludes, before);
75 mf.AddSystemIncludeDirectories(systemIncludes);
76
77 return true;
78}
79

Callers

nothing calls this directly

Calls 11

GetIncludesFunction · 0.85
appendFunction · 0.85
AddIncludeDirectoriesMethod · 0.80
emptyMethod · 0.45
GetMakefileMethod · 0.45
beginMethod · 0.45
IsOnMethod · 0.45
endMethod · 0.45
SetErrorMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…