| 46 | } |
| 47 | |
| 48 | static void FinalAction(cmMakefile& makefile, std::string const& dest, |
| 49 | std::vector<std::string> const& args) |
| 50 | { |
| 51 | bool files_mode = false; |
| 52 | if (!args.empty() && args[0] == "FILES") { |
| 53 | files_mode = true; |
| 54 | } |
| 55 | |
| 56 | std::vector<std::string> files; |
| 57 | |
| 58 | // two different options |
| 59 | if (args.size() > 1 || files_mode) { |
| 60 | // for each argument, get the programs |
| 61 | auto s = args.begin(); |
| 62 | if (files_mode) { |
| 63 | // Skip the FILES argument in files mode. |
| 64 | ++s; |
| 65 | } |
| 66 | for (; s != args.end(); ++s) { |
| 67 | // add to the result |
| 68 | files.push_back(FindInstallSource(makefile, s->c_str())); |
| 69 | } |
| 70 | } else // reg exp list |
| 71 | { |
| 72 | std::vector<std::string> programs; |
| 73 | cmSystemTools::Glob(makefile.GetCurrentSourceDirectory(), args[0], |
| 74 | programs); |
| 75 | |
| 76 | auto s = programs.begin(); |
| 77 | // for each argument, get the programs |
| 78 | for (; s != programs.end(); ++s) { |
| 79 | files.push_back(FindInstallSource(makefile, s->c_str())); |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | // Construct the destination. This command always installs under |
| 84 | // the prefix. We skip the leading slash given by the user. |
| 85 | std::string destination = dest.substr(1); |
| 86 | cmSystemTools::ConvertToUnixSlashes(destination); |
| 87 | if (destination.empty()) { |
| 88 | destination = "."; |
| 89 | } |
| 90 | |
| 91 | // Use a file install generator. |
| 92 | std::string const no_permissions; |
| 93 | std::string const no_rename; |
| 94 | bool no_exclude_from_all = false; |
| 95 | std::string no_component = |
| 96 | makefile.GetSafeDefinition("CMAKE_INSTALL_DEFAULT_COMPONENT_NAME"); |
| 97 | std::vector<std::string> no_configurations; |
| 98 | cmInstallGenerator::MessageLevel message = |
| 99 | cmInstallGenerator::SelectMessageLevel(&makefile); |
| 100 | makefile.AddInstallGenerator(cm::make_unique<cmInstallFilesGenerator>( |
| 101 | files, destination, true, no_permissions, no_configurations, no_component, |
| 102 | message, no_exclude_from_all, no_rename, false, makefile.GetBacktrace())); |
| 103 | } |
| 104 | |
| 105 | /** |
no test coverage detected
searching dependent graphs…