diff options
author | Nils Gladitz <n.gladitz@abberior-instruments.com> | 2021-05-19 08:15:16 (GMT) |
---|---|---|
committer | Nils Gladitz <n.gladitz@abberior-instruments.com> | 2021-05-19 17:17:58 (GMT) |
commit | 99ff75455ece5ec4add771a2de93b237ab858d08 (patch) | |
tree | 49f27c52bcec9b415c054ac80d3643fa03756a33 /Source/cmInstallCommand.cxx | |
parent | 82fd8b6ba36658705fc55bc40df0b6b6ec80b773 (diff) | |
download | CMake-99ff75455ece5ec4add771a2de93b237ab858d08.zip CMake-99ff75455ece5ec4add771a2de93b237ab858d08.tar.gz CMake-99ff75455ece5ec4add771a2de93b237ab858d08.tar.bz2 |
install: Implement new install(CODE|SCRIPT) option ALL_COMPONENTS
In a per-component installation the generated installation scripts
are invoked once for each component.
Per default custom installation script code added by install(CODE|SCRIPT)
only runs for one specific component in this context.
The new ALL_COMPONENTS option allows custom script code to be run once
for each component being installed.
Diffstat (limited to 'Source/cmInstallCommand.cxx')
-rw-r--r-- | Source/cmInstallCommand.cxx | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index d5d6d93..e973764 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -161,6 +161,7 @@ bool HandleScriptMode(std::vector<std::string> const& args, bool doing_script = false; bool doing_code = false; bool exclude_from_all = false; + bool all_components = false; // Scan the args once for COMPONENT. Only allow one. // @@ -172,6 +173,8 @@ bool HandleScriptMode(std::vector<std::string> const& args, } if (args[i] == "EXCLUDE_FROM_ALL") { exclude_from_all = true; + } else if (args[i] == "ALL_COMPONENTS") { + all_components = true; } } @@ -182,6 +185,11 @@ bool HandleScriptMode(std::vector<std::string> const& args, return false; } + if (all_components && componentCount == 1) { + status.SetError("ALL_COMPONENTS and COMPONENT are mutually exclusive"); + return false; + } + // Scan the args again, this time adding install generators each time we // encounter a SCRIPT or CODE arg: // @@ -208,14 +216,14 @@ bool HandleScriptMode(std::vector<std::string> const& args, } helper.Makefile->AddInstallGenerator( cm::make_unique<cmInstallScriptGenerator>( - script, false, component, exclude_from_all, + script, false, component, exclude_from_all, all_components, helper.Makefile->GetBacktrace())); } else if (doing_code) { doing_code = false; std::string const& code = arg; helper.Makefile->AddInstallGenerator( cm::make_unique<cmInstallScriptGenerator>( - code, true, component, exclude_from_all, + code, true, component, exclude_from_all, all_components, helper.Makefile->GetBacktrace())); } } |