Skip to content

Allow specifying install component name #51

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/project_parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ struct Install {
std::vector<std::string> dirs;
std::vector<std::string> configs;
std::string destination;
std::string component;
};

struct Subdir {
Expand Down
6 changes: 5 additions & 1 deletion src/cmake_generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1030,7 +1030,11 @@ void generate_cmake(const char *path, const parser::Project *parent_project) {
auto files = std::make_pair("FILES", inst.files);
auto configs = std::make_pair("CONFIGURATIONS", inst.configs);
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);
cmd("install")(targets, dirs, files, configs, destination, component);
}
Expand Down
1 change: 1 addition & 0 deletions src/project_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,7 @@ Project::Project(const Project *parent, const std::string &path, bool build) {
i.optional("dirs", inst.dirs);
i.optional("configs", inst.configs);
i.required("destination", inst.destination);
i.optional("component", inst.component);
installs.push_back(inst);
}
}
Expand Down