Browse Source

Add CPACK_NSIS_EXECUTABLES_DIRECTORY (#7828)

NSIS installers default to assuming the executables exist in a
directory named "bin" under the installation directory. As this
isn't usual for Windows programs, the addition of this variable
allows the customization of this directory and links still to be
created correctly.
Mike McQuaid 15 years ago
parent
commit
702c8f8ba7
2 changed files with 12 additions and 2 deletions
  1. 5 0
      Modules/CPack.cmake
  2. 7 2
      Source/CPack/cmCPackNSISGenerator.cxx

+ 5 - 0
Modules/CPack.cmake

@@ -257,6 +257,11 @@
 #   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.
+#
 # The following variable is specific to installers build on Mac OS X
 # using PackageMaker:
 #

+ 7 - 2
Source/CPack/cmCPackNSISGenerator.cxx

@@ -421,10 +421,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)
     {
@@ -472,7 +475,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;
@@ -486,7 +490,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