| 20 | static void NormalizeInclude(cmMakefile& mf, std::string& inc); |
| 21 | |
| 22 | bool 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 |
nothing calls this directly
no test coverage detected
searching dependent graphs…