Merge topic 'cpack-nsis-changes'
bee514c
Add CPack NSIS MUI_FINISHPAGE_RUN support (#11144)702c8f8
Add CPACK_NSIS_EXECUTABLES_DIRECTORY (#7828)fec3232
Allow NSIS package or uninstall icon (#11143)
This commit is contained in:
commit
7ebfa8218b
|
@ -257,6 +257,14 @@
|
|||
# CPACK_NSIS_DELETE_ICONS_EXTRA -Additional NSIS commands to
|
||||
# uninstall start menu shortcuts.
|
||||
#
|
||||
# CPACK_NSIS_EXECUTABLES_DIRECTORY - Creating NSIS start menu links
|
||||
# assumes that they are in 'bin' unless this variable is set.
|
||||
# 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:
|
||||
#
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -129,14 +129,21 @@ int cmCPackNSISGenerator::PackageFiles()
|
|||
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Configure file: " << nsisInFileName
|
||||
<< " to " << nsisFileName << std::endl);
|
||||
if(this->IsSet("CPACK_NSIS_MUI_ICON")
|
||||
&& this->IsSet("CPACK_NSIS_MUI_UNIICON"))
|
||||
|| this->IsSet("CPACK_NSIS_MUI_UNIICON"))
|
||||
{
|
||||
std::string installerIconCode="!define MUI_ICON \"";
|
||||
installerIconCode += this->GetOption("CPACK_NSIS_MUI_ICON");
|
||||
installerIconCode += "\"\n";
|
||||
installerIconCode += "!define MUI_UNICON \"";
|
||||
installerIconCode += this->GetOption("CPACK_NSIS_MUI_UNIICON");
|
||||
installerIconCode += "\"\n";
|
||||
std::string installerIconCode;
|
||||
if(this->IsSet("CPACK_NSIS_MUI_ICON"))
|
||||
{
|
||||
installerIconCode += "!define MUI_ICON \"";
|
||||
installerIconCode += this->GetOption("CPACK_NSIS_MUI_ICON");
|
||||
installerIconCode += "\"\n";
|
||||
}
|
||||
if(this->IsSet("CPACK_NSIS_MUI_UNIICON"))
|
||||
{
|
||||
installerIconCode += "!define MUI_UNICON \"";
|
||||
installerIconCode += this->GetOption("CPACK_NSIS_MUI_UNIICON");
|
||||
installerIconCode += "\"\n";
|
||||
}
|
||||
this->SetOptionIfNotSet("CPACK_NSIS_INSTALLER_MUI_ICON_CODE",
|
||||
installerIconCode.c_str());
|
||||
}
|
||||
|
@ -149,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())
|
||||
{
|
||||
|
@ -414,10 +432,13 @@ int cmCPackNSISGenerator::InitializeInternal()
|
|||
return 0;
|
||||
}
|
||||
this->SetOptionIfNotSet("CPACK_INSTALLER_PROGRAM", nsisPath.c_str());
|
||||
this->SetOptionIfNotSet("CPACK_NSIS_EXECUTABLES_DIRECTORY", "bin");
|
||||
const char* cpackPackageExecutables
|
||||
= this->GetOption("CPACK_PACKAGE_EXECUTABLES");
|
||||
const char* cpackPackageDeskTopLinks
|
||||
= this->GetOption("CPACK_CREATE_DESKTOP_LINKS");
|
||||
const char* cpackNsisExecutablesDirectory
|
||||
= this->GetOption("CPACK_NSIS_EXECUTABLES_DIRECTORY");
|
||||
std::vector<std::string> cpackPackageDesktopLinksVector;
|
||||
if(cpackPackageDeskTopLinks)
|
||||
{
|
||||
|
@ -465,7 +486,8 @@ int cmCPackNSISGenerator::InitializeInternal()
|
|||
++ it;
|
||||
std::string linkName = *it;
|
||||
str << " CreateShortCut \"$SMPROGRAMS\\$STARTMENU_FOLDER\\"
|
||||
<< linkName << ".lnk\" \"$INSTDIR\\bin\\" << execName << ".exe\""
|
||||
<< linkName << ".lnk\" \"$INSTDIR\\"
|
||||
<< cpackNsisExecutablesDirectory << "\\" << execName << ".exe\""
|
||||
<< std::endl;
|
||||
deleteStr << " Delete \"$SMPROGRAMS\\$MUI_TEMP\\" << linkName
|
||||
<< ".lnk\"" << std::endl;
|
||||
|
@ -479,7 +501,8 @@ int cmCPackNSISGenerator::InitializeInternal()
|
|||
{
|
||||
str << " StrCmp \"$INSTALL_DESKTOP\" \"1\" 0 +2\n";
|
||||
str << " CreateShortCut \"$DESKTOP\\"
|
||||
<< linkName << ".lnk\" \"$INSTDIR\\bin\\" << execName << ".exe\""
|
||||
<< linkName << ".lnk\" \"$INSTDIR\\"
|
||||
<< cpackNsisExecutablesDirectory << "\\" << execName << ".exe\""
|
||||
<< std::endl;
|
||||
deleteStr << " StrCmp \"$INSTALL_DESKTOP\" \"1\" 0 +2\n";
|
||||
deleteStr << " Delete \"$DESKTOP\\" << linkName
|
||||
|
|
Loading…
Reference in New Issue