| 8 | #include "cmSystemTools.h" |
| 9 | |
| 10 | bool cmSubdirCommand(std::vector<std::string> const& args, |
| 11 | cmExecutionStatus& status) |
| 12 | { |
| 13 | if (args.empty()) { |
| 14 | status.SetError("called with incorrect number of arguments"); |
| 15 | return false; |
| 16 | } |
| 17 | bool res = true; |
| 18 | bool excludeFromAll = false; |
| 19 | cmMakefile& mf = status.GetMakefile(); |
| 20 | |
| 21 | for (std::string const& i : args) { |
| 22 | if (i == "EXCLUDE_FROM_ALL") { |
| 23 | excludeFromAll = true; |
| 24 | continue; |
| 25 | } |
| 26 | if (i == "PREORDER") { |
| 27 | // Ignored |
| 28 | continue; |
| 29 | } |
| 30 | |
| 31 | // if they specified a relative path then compute the full |
| 32 | std::string srcPath = mf.GetCurrentSourceDirectory() + "/" + i; |
| 33 | if (cmSystemTools::FileIsDirectory(srcPath)) { |
| 34 | std::string binPath = mf.GetCurrentBinaryDirectory() + "/" + i; |
| 35 | mf.AddSubDirectory(srcPath, binPath, excludeFromAll, false, false); |
| 36 | } |
| 37 | // otherwise it is a full path |
| 38 | else if (cmSystemTools::FileIsDirectory(i)) { |
| 39 | // we must compute the binPath from the srcPath, we just take the last |
| 40 | // element from the source path and use that |
| 41 | std::string binPath = mf.GetCurrentBinaryDirectory() + "/" + |
| 42 | cmSystemTools::GetFilenameName(i); |
| 43 | mf.AddSubDirectory(i, binPath, excludeFromAll, false, false); |
| 44 | } else { |
| 45 | status.SetError(cmStrCat("Incorrect SUBDIRS command. Directory: ", i, |
| 46 | " does not exist.")); |
| 47 | res = false; |
| 48 | } |
| 49 | } |
| 50 | return res; |
| 51 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…