Merge pull request #51 from cursey/improvement/install-component

Allow specifying install component name
main
Duncan Ogilvie 3 years ago committed by GitHub
commit e7d9faa6bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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