[CMake] [PATCHES] Linux NSIS support

Pierre Habouzit madcoder at debian.org
Wed Jun 13 06:33:34 EDT 2007


  NSIS also works for linux, it just has a small different command line
interface. Here is a patch from Michal Čihař to make it work.

Index: cmake-2.4.6/Source/CPack/cmCPackGenerators.cxx
===================================================================
--- cmake-2.4.6.orig/Source/CPack/cmCPackGenerators.cxx
+++ cmake-2.4.6/Source/CPack/cmCPackGenerators.cxx
@@ -35,10 +35,8 @@
     cmCPackTGZGenerator::CreateGenerator);
   this->RegisterGenerator("STGZ", "Self extracting Tar GZip compression",
     cmCPackSTGZGenerator::CreateGenerator);
-#ifdef _WIN32
   this->RegisterGenerator("NSIS", "Null Soft Installer",
     cmCPackNSISGenerator::CreateGenerator);
-#endif
   this->RegisterGenerator("ZIP", "ZIP file format",
     cmCPackZIPGenerator::CreateGenerator);
   this->RegisterGenerator("TBZ2", "Tar BZip2 compression",
Index: cmake-2.4.6/Source/CPack/cmCPackNSISGenerator.cxx
===================================================================
--- cmake-2.4.6.orig/Source/CPack/cmCPackNSISGenerator.cxx
+++ cmake-2.4.6/Source/CPack/cmCPackNSISGenerator.cxx
@@ -29,6 +29,13 @@
 #include <cmsys/Directory.hxx>
 #include <cmsys/RegularExpression.hxx>
 
+/* NSIS uses different command line syntax on Windows and others */
+#ifdef WIN32
+#define NSIS_OPT "/"
+#else
+#define NSIS_OPT "-"
+#endif
+
 //----------------------------------------------------------------------
 cmCPackNSISGenerator::cmCPackNSISGenerator()
 {
@@ -144,6 +151,7 @@
     << std::endl);
   std::vector<std::string> path;
   std::string nsisPath;
+#ifdef WIN32
   if ( !cmsys::SystemTools::ReadRegistryValue(
       "HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS", nsisPath) )
     {
@@ -156,6 +164,7 @@
     return 0;
     }
   path.push_back(nsisPath);
+#endif
   nsisPath = cmSystemTools::FindProgram("makensis", path, false);
   if ( nsisPath.empty() )
     {
@@ -163,7 +172,7 @@
       << std::endl);
     return 0;
     }
-  std::string nsisCmd = "\"" + nsisPath + "\" /VERSION";
+  std::string nsisCmd = "\"" + nsisPath + "\" " NSIS_OPT "VERSION";
   cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Test NSIS version: "
     << nsisCmd.c_str() << std::endl);
   std::string output;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://public.kitware.com/pipermail/cmake/attachments/20070613/cb36b507/attachment.pgp


More information about the CMake mailing list