Skip to content

Commit e7d9faa

Browse files
authored
Merge pull request #51 from cursey/improvement/install-component
Allow specifying install component name
2 parents e8c6ccb + 6f8b07a commit e7d9faa

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

include/project_parser.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ struct Install {
127127
std::vector<std::string> dirs;
128128
std::vector<std::string> configs;
129129
std::string destination;
130+
std::string component;
130131
};
131132

132133
struct Subdir {

src/cmake_generator.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,11 @@ void generate_cmake(const char *path, const parser::Project *parent_project) {
10301030
auto files = std::make_pair("FILES", inst.files);
10311031
auto configs = std::make_pair("CONFIGURATIONS", inst.configs);
10321032
auto destination = std::make_pair("DESTINATION", inst.destination);
1033-
auto component = std::make_pair("COMPONENT", inst.targets.empty() ? "" : inst.targets.front());
1033+
auto component_name = inst.component;
1034+
if (component_name.empty() && !inst.targets.empty()) {
1035+
component_name = inst.targets.front();
1036+
}
1037+
auto component = std::make_pair("COMPONENT", component_name);
10341038
ConditionScope cs(gen, inst.condition);
10351039
cmd("install")(targets, dirs, files, configs, destination, component);
10361040
}

src/project_parser.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,7 @@ Project::Project(const Project *parent, const std::string &path, bool build) {
551551
i.optional("dirs", inst.dirs);
552552
i.optional("configs", inst.configs);
553553
i.required("destination", inst.destination);
554+
i.optional("component", inst.component);
554555
installs.push_back(inst);
555556
}
556557
}

0 commit comments

Comments
 (0)