Page MenuHomePhabricator

No desktop icon created using windows installer
Closed, ResolvedPublic

Description

Using the windows installer the option for creating a desktop icon during the installation process shows no effect.

Event Timeline

This seems to be due to desktop shortcuts not being managed in the CMake/NSIS.template.in

For reference

Adding

;Create desktop shortcuts
${If} $INSTALL_DESKTOP == "1"
@CPACK_CREATE_DESKTOP_LINKS@
${EndIf}

to the template after the ";Create shortcuts" section results in

;Create desktop shortcuts
${If} $INSTALL_DESKTOP == "1"
Workbench;Diffusion
${EndIf}

in the project.nsi. So it seems the variables are available there.

Compare the following code in the CMake source cmCPackNSISGEnerator.cxx

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\\"
    << cpackNsisExecutablesDirectory << "\\" << execName << ".exe\""
    << std::endl;
  deleteStr << "  Delete \"$SMPROGRAMS\\$MUI_TEMP\\" << linkName
    << ".lnk\"" << std::endl;
  // see if CPACK_CREATE_DESKTOP_LINK_ExeName is on
  // if so add a desktop link
  if(!cpackPackageDesktopLinksVector.empty() &&
     std::find(cpackPackageDesktopLinksVector.begin(),
               cpackPackageDesktopLinksVector.end(),
               execName)
     != cpackPackageDesktopLinksVector.end())
    {
    str << "  StrCmp \"$INSTALL_DESKTOP\" \"1\" 0 +2\n";
    str << "    CreateShortCut \"$DESKTOP\\"
        << linkName << ".lnk\" \"$INSTDIR\\"
        << cpackNsisExecutablesDirectory << "\\" << execName << ".exe\""
        << std::endl;
    deleteStr << "  StrCmp \"$INSTALL_DESKTOP\" \"1\" 0 +2\n";
    deleteStr << "    Delete \"$DESKTOP\\" << linkName
              << ".lnk\"" << std::endl;
    }
  }
}

User goch has pushed new remote branch:

bug-19216-nsis-installer-does-not-produce-desktop-icons

[4e5309]: Merge branch 'bug-19216-nsis-installer-does-not-produce-desktop-icons'

Merged commits:

2015-09-02 14:23:20 Caspar Goch [d785d8]
Add an additional parameter to the application entry

This parameter should specify the name of the resulting executable
without file suffix (e.g. MitkWorkbench). This is needed to define
the desktop shortcuts for NSIS via CPack.

Shortcuts are created again. They will not be created if you select "Create desktop shortcut" and "Do not create shortcuts" simultaneously.

A unintended side-effect of the fix was the target_libraries.cmake being ignored. A fix is available in the bug branch.

[3e6b19]: Merge branch 'bug-19216-nsis-installer-does-not-produce-desktop-icons'

Merged commits:

2015-09-09 15:04:55 Caspar Goch [c23407]
adjust ctk macro feeding for app requirements to new format