CPackIFW: Add support for RunProgram* config variables

This patch adds support for specifying <RunProgram>,
<RunProgramArguments>, and <RunProgramDescription> in the IFW
configuration file.
This commit is contained in:
Erlend E. Aasland
2021-10-07 22:56:44 +02:00
parent 47cc20fc67
commit f2f4e66f64
4 changed files with 82 additions and 0 deletions

View File

@@ -264,6 +264,34 @@ Package
This feature is available for QtIFW 4.0.0 or newer.
.. variable:: CPACK_IFW_PACKAGE_RUN_PROGRAM
.. versionadded:: 3.23
Command executed after the installer is done if the user accepts the action.
Provide the full path to the application.
This feature is available for QtIFW 4.0.0 and newer.
.. variable:: CPACK_IFW_PACKAGE_RUN_PROGRAM_ARGUMENTS
.. versionadded:: 3.23
List of arguments passed to the program specified in
:variable:`CPACK_IFW_PACKAGE_RUN_PROGRAM`.
This feature is available for QtIFW 4.0.0 and newer.
.. variable:: CPACK_IFW_PACKAGE_RUN_PROGRAM_DESCRIPTION
.. versionadded:: 3.23
Text shown next to the check box for running the program after the
installation. If :variable:`CPACK_IFW_PACKAGE_RUN_PROGRAM` is set but no
description provided, the UI will display ``Run <Name> now``. instead.
This feature is available for QtIFW 4.0.0 and newer.
Components
""""""""""

View File

@@ -0,0 +1,10 @@
cpackifw-package-run-program
----------------------------
* The :cpack_gen:`CPack IFW Generator` gained the new
:variable:`CPACK_IFW_PACKAGE_RUN_PROGRAM`,
:variable:`CPACK_IFW_PACKAGE_RUN_PROGRAM_ARGUMENTS`, and
:variable:`CPACK_IFW_PACKAGE_RUN_PROGRAM_DESCRIPTION` variables for executing
a command after the installer is done if the user accepts the action.
This feature is available for QtIFW 4.0 and newer.

View File

@@ -292,6 +292,20 @@ void cmCPackIFWInstaller::ConfigureFromOptions()
this->ProductImages.clear();
cmExpandList(productImages, this->ProductImages);
}
// Run program, run program arguments, and run program description
if (cmValue program = this->GetOption("CPACK_IFW_PACKAGE_RUN_PROGRAM")) {
this->RunProgram = *program;
}
if (cmValue arguments =
this->GetOption("CPACK_IFW_PACKAGE_RUN_PROGRAM_ARGUMENTS")) {
this->RunProgramArguments.clear();
cmExpandList(arguments, this->RunProgramArguments);
}
if (cmValue description =
this->GetOption("CPACK_IFW_PACKAGE_RUN_PROGRAM_DESCRIPTION")) {
this->RunProgramDescription = *description;
}
}
/** \class cmCPackIFWResourcesParser
@@ -542,6 +556,25 @@ void cmCPackIFWInstaller::GenerateInstallerFile()
xout.Element("DisableCommandLineInterface",
this->DisableCommandLineInterface);
}
// RunProgram
if (!this->RunProgram.empty()) {
xout.Element("RunProgram", this->RunProgram);
}
// RunProgramArguments
if (!this->RunProgramArguments.empty()) {
xout.StartElement("RunProgramArguments");
for (const auto& arg : this->RunProgramArguments) {
xout.Element("Argument", arg);
}
xout.EndElement();
}
// RunProgramDescription
if (!this->RunProgramDescription.empty()) {
xout.Element("RunProgramDescription", this->RunProgramDescription);
}
}
if (!this->RemoveTargetDir.empty()) {

View File

@@ -124,6 +124,17 @@ public:
/// A list of images to be shown on PerformInstallationPage.
std::vector<std::string> ProductImages;
/// Command executed after the installer is done if the user accepts the
/// action
std::string RunProgram;
/// Arguments passed to the program specified in <RunProgram>
std::vector<std::string> RunProgramArguments;
/// Text shown next to the check box for running the program after the
/// installation
std::string RunProgramDescription;
public:
// Internal implementation