Allow specifying install component name

main
cursey 3 years ago
parent e8c6ccb698
commit 6f8b07a801
No known key found for this signature in database
GPG Key ID: A6A7163A1B8FD42C

@ -127,6 +127,7 @@ struct Install {
std::vector<std::string> dirs; std::vector<std::string> dirs;
std::vector<std::string> configs; std::vector<std::string> configs;
std::string destination; std::string destination;
std::string component;
}; };
struct Subdir { struct Subdir {

@ -1030,7 +1030,11 @@ void generate_cmake(const char *path, const parser::Project *parent_project) {
auto files = std::make_pair("FILES", inst.files); auto files = std::make_pair("FILES", inst.files);
auto configs = std::make_pair("CONFIGURATIONS", inst.configs); auto configs = std::make_pair("CONFIGURATIONS", inst.configs);
auto destination = std::make_pair("DESTINATION", inst.destination); auto destination = std::make_pair("DESTINATION", inst.destination);
auto component = std::make_pair("COMPONENT", inst.targets.empty() ? "" : inst.targets.front()); auto component_name = inst.component;
if (component_name.empty() && !inst.targets.empty()) {
component_name = inst.targets.front();
}
auto component = std::make_pair("COMPONENT", component_name);
ConditionScope cs(gen, inst.condition); ConditionScope cs(gen, inst.condition);
cmd("install")(targets, dirs, files, configs, destination, component); cmd("install")(targets, dirs, files, configs, destination, component);
} }

@ -551,6 +551,7 @@ Project::Project(const Project *parent, const std::string &path, bool build) {
i.optional("dirs", inst.dirs); i.optional("dirs", inst.dirs);
i.optional("configs", inst.configs); i.optional("configs", inst.configs);
i.required("destination", inst.destination); i.required("destination", inst.destination);
i.optional("component", inst.component);
installs.push_back(inst); installs.push_back(inst);
} }
} }

Loading…
Cancel
Save