Add install.optional flag

main
Duncan Ogilvie 2 years ago
parent e98a906231
commit e69cf4d2b9

@ -204,4 +204,5 @@ component = "mycomponent"
files = ["content/my.png"] files = ["content/my.png"]
dirs = ["include"] dirs = ["include"]
configs = ["Release", "Debug"] configs = ["Release", "Debug"]
optional = false
``` ```

@ -128,6 +128,7 @@ struct Install {
std::vector<std::string> configs; std::vector<std::string> configs;
std::string destination; std::string destination;
std::string component; std::string component;
bool optional = false;
}; };
struct Subdir { struct Subdir {

@ -1045,8 +1045,9 @@ void generate_cmake(const char *path, const parser::Project *parent_project) {
component_name = inst.targets.front(); component_name = inst.targets.front();
} }
auto component = std::make_pair("COMPONENT", component_name); auto component = std::make_pair("COMPONENT", component_name);
auto optional = inst.optional ? "OPTIONAL" : "";
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, optional);
} }
} }

@ -619,6 +619,7 @@ Project::Project(const Project *parent, const std::string &path, bool build) {
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); i.optional("component", inst.component);
i.optional("optional", inst.optional);
installs.push_back(inst); installs.push_back(inst);
} }
} }

Loading…
Cancel
Save