ENH: NSIS exists also for Linux, not only Windows, so enable it there too

patch by   Michal Čihař <michal (AT) cihar.com>

Alex
This commit is contained in:
Alexander Neundorf 2007-06-18 09:00:33 -04:00
parent dbbd521461
commit ef81ac50e5
2 changed files with 12 additions and 6 deletions

View File

@ -23,9 +23,7 @@
#include "cmCPackTarCompressGenerator.h" #include "cmCPackTarCompressGenerator.h"
#include "cmCPackZIPGenerator.h" #include "cmCPackZIPGenerator.h"
#include "cmCPackSTGZGenerator.h" #include "cmCPackSTGZGenerator.h"
#ifdef _WIN32 #include "cmCPackNSISGenerator.h"
# include "cmCPackNSISGenerator.h"
#endif
#ifdef __APPLE__ #ifdef __APPLE__
# include "cmCPackPackageMakerGenerator.h" # include "cmCPackPackageMakerGenerator.h"
# include "cmCPackOSXX11Generator.h" # include "cmCPackOSXX11Generator.h"
@ -45,10 +43,8 @@ cmCPackGenerators::cmCPackGenerators()
cmCPackTGZGenerator::CreateGenerator); cmCPackTGZGenerator::CreateGenerator);
this->RegisterGenerator("STGZ", "Self extracting Tar GZip compression", this->RegisterGenerator("STGZ", "Self extracting Tar GZip compression",
cmCPackSTGZGenerator::CreateGenerator); cmCPackSTGZGenerator::CreateGenerator);
#ifdef _WIN32
this->RegisterGenerator("NSIS", "Null Soft Installer", this->RegisterGenerator("NSIS", "Null Soft Installer",
cmCPackNSISGenerator::CreateGenerator); cmCPackNSISGenerator::CreateGenerator);
#endif
#ifdef __CYGWIN__ #ifdef __CYGWIN__
this->RegisterGenerator("CygwinBinary", "Cygwin Binary Installer", this->RegisterGenerator("CygwinBinary", "Cygwin Binary Installer",
cmCPackCygwinBinaryGenerator::CreateGenerator); cmCPackCygwinBinaryGenerator::CreateGenerator);

View File

@ -29,6 +29,13 @@
#include <cmsys/Directory.hxx> #include <cmsys/Directory.hxx>
#include <cmsys/RegularExpression.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() cmCPackNSISGenerator::cmCPackNSISGenerator()
{ {
@ -144,6 +151,8 @@ int cmCPackNSISGenerator::InitializeInternal()
<< std::endl); << std::endl);
std::vector<std::string> path; std::vector<std::string> path;
std::string nsisPath; std::string nsisPath;
#ifdef _WIN32
if ( !cmsys::SystemTools::ReadRegistryValue( if ( !cmsys::SystemTools::ReadRegistryValue(
"HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS", nsisPath) ) "HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS", nsisPath) )
{ {
@ -156,6 +165,7 @@ int cmCPackNSISGenerator::InitializeInternal()
return 0; return 0;
} }
path.push_back(nsisPath); path.push_back(nsisPath);
#endif
nsisPath = cmSystemTools::FindProgram("makensis", path, false); nsisPath = cmSystemTools::FindProgram("makensis", path, false);
if ( nsisPath.empty() ) if ( nsisPath.empty() )
{ {
@ -163,7 +173,7 @@ int cmCPackNSISGenerator::InitializeInternal()
<< std::endl); << std::endl);
return 0; return 0;
} }
std::string nsisCmd = "\"" + nsisPath + "\" /VERSION"; std::string nsisCmd = "\"" + nsisPath + "\" " NSIS_OPT "VERSION";
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Test NSIS version: " cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Test NSIS version: "
<< nsisCmd.c_str() << std::endl); << nsisCmd.c_str() << std::endl);
std::string output; std::string output;