ENH: Better handling of executables on windows
This commit is contained in:
parent
c9ecd78237
commit
21975ceda5
|
@ -358,7 +358,8 @@ Section "Dummy Section" SecDummy
|
||||||
|
|
||||||
;Create shortcuts
|
;Create shortcuts
|
||||||
CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
|
CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
|
||||||
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\@CPACK_PACKAGE_EXECUTABLE_LABEL@.lnk" "$INSTDIR\bin\@CPACK_PACKAGE_EXECUTABLE@.exe"
|
@CPACK_NSIS_CREATE_ICONS@
|
||||||
|
@CPACK_NSIS_CREATE_EXTRA_ICONS@
|
||||||
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
|
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
|
||||||
|
|
||||||
!insertmacro MUI_STARTMENU_WRITE_END
|
!insertmacro MUI_STARTMENU_WRITE_END
|
||||||
|
@ -414,7 +415,8 @@ Section "Uninstall"
|
||||||
!insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
|
!insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
|
||||||
|
|
||||||
Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
|
Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
|
||||||
Delete "$SMPROGRAMS\$MUI_TEMP\@CPACK_PACKAGE_EXECUTABLE_LABEL@.lnk"
|
@CPACK_NSIS_DELETE_ICONS@
|
||||||
|
@CPACK_NSIS_DELETE_EXTRA_ICONS@
|
||||||
|
|
||||||
;Delete empty start menu parent diretories
|
;Delete empty start menu parent diretories
|
||||||
StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
|
StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
|
||||||
|
|
|
@ -101,6 +101,34 @@ int cmCPackNSISGenerator::Initialize(const char* name, cmMakefile* mf)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
this->SetOption("CPACK_INSTALLER_PROGRAM", nsisPath.c_str());
|
this->SetOption("CPACK_INSTALLER_PROGRAM", nsisPath.c_str());
|
||||||
|
|
||||||
|
const char* cpackPackageExecutables = this->GetOption("CPACK_PACKAGE_EXECUTABLES");
|
||||||
|
if ( cpackPackageExecutables )
|
||||||
|
{
|
||||||
|
cmCPackLogger(cmCPackLog::LOG_ERROR, "The cpackPackageExecutables: " << cpackPackageExecutables << "." << std::endl);
|
||||||
|
cmOStringStream str;
|
||||||
|
cmOStringStream deleteStr;
|
||||||
|
std::vector<std::string> cpackPackageExecutablesVector;
|
||||||
|
cmSystemTools::ExpandListArgument(cpackPackageExecutables,cpackPackageExecutablesVector);
|
||||||
|
if ( cpackPackageExecutablesVector.size() % 2 != 0 )
|
||||||
|
{
|
||||||
|
cmCPackLogger(cmCPackLog::LOG_ERROR, "CPACK_PACKAGE_EXECUTABLES should contain pairs of <executable> and <icon name>." << std::endl);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
std::vector<std::string>::iterator it;
|
||||||
|
for ( it = cpackPackageExecutablesVector.begin(); it != cpackPackageExecutablesVector.end();
|
||||||
|
++it )
|
||||||
|
{
|
||||||
|
std::string execName = *it;
|
||||||
|
++ it;
|
||||||
|
std::string linkName = *it;
|
||||||
|
str << " CreateShortCut \"$SMPROGRAMS\\$STARTMENU_FOLDER\\" << linkName << ".lnk\"" "\"$INSTDIR\\bin\\" << execName << ".exe\"" << std::endl;
|
||||||
|
deleteStr << " Delete \"$SMPROGRAMS\\$MUI_TEMP\\" << linkName << ".lnk\"" << std::endl;
|
||||||
|
}
|
||||||
|
this->SetOption("CPACK_NSIS_CREATE_ICONS", str.str().c_str());
|
||||||
|
this->SetOption("CPACK_NSIS_DELETE_ICONS", deleteStr.str().c_str());
|
||||||
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue