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

Function GetIncludes

Source/cmIncludeDirectoryCommand.cxx:92–113  ·  view source on GitHub ↗

do a lot of cleanup on the arguments because this is one place where folks sometimes take the output of a program and pass it directly into this command not thinking that a single argument could be filled with spaces and newlines etc like below: " /foo/bar /boo/hoo /dingle/berry " ideally that should be three separate arguments but when sucking the output from a program and passing it into a c

Source from the content-addressed store, hash-verified

90// always happen
91//
92static void GetIncludes(cmMakefile& mf, std::string const& arg,
93 std::vector<std::string>& incs)
94{
95 // break apart any line feed arguments
96 std::string::size_type pos = 0;
97 std::string::size_type lastPos = 0;
98 while ((pos = arg.find('\n', lastPos)) != std::string::npos) {
99 if (pos) {
100 std::string inc = arg.substr(lastPos, pos);
101 NormalizeInclude(mf, inc);
102 if (!inc.empty()) {
103 incs.push_back(std::move(inc));
104 }
105 }
106 lastPos = pos + 1;
107 }
108 std::string inc = arg.substr(lastPos);
109 NormalizeInclude(mf, inc);
110 if (!inc.empty()) {
111 incs.push_back(std::move(inc));
112 }
113}
114
115static void NormalizeInclude(cmMakefile& mf, std::string& inc)
116{

Callers 1

Calls 6

NormalizeIncludeFunction · 0.85
moveFunction · 0.85
push_backMethod · 0.80
findMethod · 0.45
substrMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…