summaryrefslogtreecommitdiffstats
path: root/Source/CPack
diff options
context:
space:
mode:
authorJohnny Jazeix <jazeix@gmail.com>2022-09-24 20:42:09 (GMT)
committerJohnny Jazeix <jazeix@gmail.com>2022-09-26 15:58:12 (GMT)
commitd1613ac880df62b171f7f929d98dfaa62dd78417 (patch)
tree243952b99a3c9f44df59231092b501db71b0ab09 /Source/CPack
parentc87fb83426228fed2f6fb0109d810910f53da65b (diff)
downloadCMake-d1613ac880df62b171f7f929d98dfaa62dd78417.zip
CMake-d1613ac880df62b171f7f929d98dfaa62dd78417.tar.gz
CMake-d1613ac880df62b171f7f929d98dfaa62dd78417.tar.bz2
CPack/NSIS: Add options to set makensis arguments
Fixes: #23446
Diffstat (limited to 'Source/CPack')
-rw-r--r--Source/CPack/cmCPackNSISGenerator.cxx34
1 files changed, 32 insertions, 2 deletions
diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx
index 217f716..6ca5783 100644
--- a/Source/CPack/cmCPackNSISGenerator.cxx
+++ b/Source/CPack/cmCPackNSISGenerator.cxx
@@ -242,6 +242,33 @@ int cmCPackNSISGenerator::PackageFiles()
this->SetOptionIfNotSet("CPACK_NSIS_LICENSE_PAGE", licenceCode);
}
+ std::string nsisPreArguments;
+ if (cmValue nsisArguments =
+ this->GetOption("CPACK_NSIS_EXECUTABLE_PRE_ARGUMENTS")) {
+ std::vector<std::string> expandedArguments;
+ cmExpandList(nsisArguments, expandedArguments);
+
+ for (auto& arg : expandedArguments) {
+ if (!cmHasPrefix(arg, NSIS_OPT)) {
+ nsisPreArguments = cmStrCat(nsisPreArguments, NSIS_OPT);
+ }
+ nsisPreArguments = cmStrCat(nsisPreArguments, arg, ' ');
+ }
+ }
+
+ std::string nsisPostArguments;
+ if (cmValue nsisArguments =
+ this->GetOption("CPACK_NSIS_EXECUTABLE_POST_ARGUMENTS")) {
+ std::vector<std::string> expandedArguments;
+ cmExpandList(nsisArguments, expandedArguments);
+ for (auto& arg : expandedArguments) {
+ if (!cmHasPrefix(arg, NSIS_OPT)) {
+ nsisPostArguments = cmStrCat(nsisPostArguments, NSIS_OPT);
+ }
+ nsisPostArguments = cmStrCat(nsisPostArguments, arg, ' ');
+ }
+ }
+
// Setup all of the component sections
if (this->Components.empty()) {
this->SetOptionIfNotSet("CPACK_NSIS_INSTALLATION_TYPES", "");
@@ -358,8 +385,11 @@ int cmCPackNSISGenerator::PackageFiles()
this->ConfigureFile(nsisInInstallOptions, nsisInstallOptions);
this->ConfigureFile(nsisInFileName, nsisFileName);
std::string nsisCmd =
- cmStrCat('"', this->GetOption("CPACK_INSTALLER_PROGRAM"), "\" \"",
- nsisFileName, '"');
+ cmStrCat('"', this->GetOption("CPACK_INSTALLER_PROGRAM"), "\" ",
+ nsisPreArguments, " \"", nsisFileName, '"');
+ if (!nsisPostArguments.empty()) {
+ nsisCmd = cmStrCat(nsisCmd, " ", nsisPostArguments);
+ }
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << nsisCmd << std::endl);
std::string output;
int retVal = 1;