From bee514c3611f7a7b972d9ade14f94c0f25bc001e Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Thu, 6 Jan 2011 13:44:50 +0000 Subject: Add CPack NSIS MUI_FINISHPAGE_RUN support (#11144) MUI_FINISHPAGE_RUN is frequently used with NSIS and provides a checkbox on the finish page of an installer which specifies whether the specified executable should be run when the installer exits. This commit adds support for this setting in CPack. --- Modules/CPack.cmake | 3 +++ Modules/NSIS.template.in | 1 + Source/CPack/cmCPackNSISGenerator.cxx | 11 +++++++++++ 3 files changed, 15 insertions(+) diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index dc65b5a..5f9f05f 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -262,6 +262,9 @@ # For example, you would set this to 'exec' if your executables are # in an exec directory. # +# CPACK_NSIS_MUI_FINISHPAGE_RUN - Specify an executable to add an option +# to run on the finish page of the NSIS installer. +# # The following variable is specific to installers build on Mac OS X # using PackageMaker: # diff --git a/Modules/NSIS.template.in b/Modules/NSIS.template.in index 776bc07..ffe0515 100644 --- a/Modules/NSIS.template.in +++ b/Modules/NSIS.template.in @@ -540,6 +540,7 @@ FunctionEnd @CPACK_NSIS_INSTALLER_MUI_ICON_CODE@ @CPACK_NSIS_INSTALLER_ICON_CODE@ @CPACK_NSIS_INSTALLER_MUI_COMPONENTS_DESC@ +@CPACK_NSIS_INSTALLER_MUI_FINISHPAGE_RUN_CODE@ ;-------------------------------- ;Pages diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index d27ab0a..97885d5 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -156,6 +156,17 @@ int cmCPackNSISGenerator::PackageFiles() installerIconCode.c_str()); } + if(this->IsSet("CPACK_NSIS_MUI_FINISHPAGE_RUN")) + { + std::string installerRunCode = "!define MUI_FINISHPAGE_RUN \"$INSTDIR\\"; + installerRunCode += this->GetOption("CPACK_NSIS_EXECUTABLES_DIRECTORY"); + installerRunCode += "\\"; + installerRunCode += this->GetOption("CPACK_NSIS_MUI_FINISHPAGE_RUN"); + installerRunCode += "\"\n"; + this->SetOptionIfNotSet("CPACK_NSIS_INSTALLER_MUI_FINISHPAGE_RUN_CODE", + installerRunCode.c_str()); + } + // Setup all of the component sections if (this->Components.empty()) { -- cgit v0.12