diff options
author | Brad King <brad.king@kitware.com> | 2022-09-27 14:25:45 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2022-09-27 14:26:12 (GMT) |
commit | 954b861dba50b4f84c2a1e58e5bdf3f05179572b (patch) | |
tree | 089a69ff5b87999512229ebd74561290b90ef881 /Source | |
parent | a57e7350d58e116823a386a53333b46ac50ef590 (diff) | |
parent | d1613ac880df62b171f7f929d98dfaa62dd78417 (diff) | |
download | CMake-954b861dba50b4f84c2a1e58e5bdf3f05179572b.zip CMake-954b861dba50b4f84c2a1e58e5bdf3f05179572b.tar.gz CMake-954b861dba50b4f84c2a1e58e5bdf3f05179572b.tar.bz2 |
Merge topic 'cpack-nsis-arguments-command-line'
d1613ac880 CPack/NSIS: Add options to set makensis arguments
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7715
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CPack/cmCPackNSISGenerator.cxx | 34 |
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; |