CPack: Fix NSIS version check without release version (#9721)
Only check a release version for the minimum required version. If NSIS returns a CVS build version string (as when built by Macports), skip the version check altogether and assume a sufficiently new version. Also correctly handle the case where the version check fails and the CPACK_TOPLEVEL_DIRECTORY option is not set. Co-Author: Graham Menhennitt <graham@menhennitt.com.au>
This commit is contained in:
parent
aa027af9af
commit
794789047d
|
@ -432,11 +432,14 @@ int cmCPackNSISGenerator::InitializeInternal()
|
||||||
int retVal = 1;
|
int retVal = 1;
|
||||||
bool resS = cmSystemTools::RunSingleCommand(nsisCmd.c_str(),
|
bool resS = cmSystemTools::RunSingleCommand(nsisCmd.c_str(),
|
||||||
&output, &retVal, 0, this->GeneratorVerbose, 0);
|
&output, &retVal, 0, this->GeneratorVerbose, 0);
|
||||||
|
|
||||||
cmsys::RegularExpression versionRex("v([0-9]+.[0-9]+)");
|
cmsys::RegularExpression versionRex("v([0-9]+.[0-9]+)");
|
||||||
if ( !resS || retVal || !versionRex.find(output))
|
cmsys::RegularExpression versionRexCVS("v(.*)\\.cvs");
|
||||||
|
if ( !resS || retVal ||
|
||||||
|
(!versionRex.find(output) && !versionRexCVS.find(output))
|
||||||
|
)
|
||||||
{
|
{
|
||||||
std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
|
const char* topDir = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
|
||||||
|
std::string tmpFile = topDir ? topDir : ".";
|
||||||
tmpFile += "/NSISOutput.log";
|
tmpFile += "/NSISOutput.log";
|
||||||
cmGeneratedFileStream ofs(tmpFile.c_str());
|
cmGeneratedFileStream ofs(tmpFile.c_str());
|
||||||
ofs << "# Run command: " << nsisCmd.c_str() << std::endl
|
ofs << "# Run command: " << nsisCmd.c_str() << std::endl
|
||||||
|
@ -448,17 +451,26 @@ int cmCPackNSISGenerator::InitializeInternal()
|
||||||
<< "Please check " << tmpFile.c_str() << " for errors" << std::endl);
|
<< "Please check " << tmpFile.c_str() << " for errors" << std::endl);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
double nsisVersion = atof(versionRex.match(1).c_str());
|
if ( versionRex.find(output))
|
||||||
double minNSISVersion = 2.09;
|
|
||||||
cmCPackLogger(cmCPackLog::LOG_DEBUG, "NSIS Version: "
|
|
||||||
<< nsisVersion << std::endl);
|
|
||||||
if ( nsisVersion < minNSISVersion )
|
|
||||||
{
|
{
|
||||||
cmCPackLogger(cmCPackLog::LOG_ERROR,
|
double nsisVersion = atof(versionRex.match(1).c_str());
|
||||||
"CPack requires NSIS Version 2.09 or greater. NSIS found on the system "
|
double minNSISVersion = 2.09;
|
||||||
"was: "
|
cmCPackLogger(cmCPackLog::LOG_DEBUG, "NSIS Version: "
|
||||||
<< nsisVersion << std::endl);
|
<< nsisVersion << std::endl);
|
||||||
return 0;
|
if ( nsisVersion < minNSISVersion )
|
||||||
|
{
|
||||||
|
cmCPackLogger(cmCPackLog::LOG_ERROR,
|
||||||
|
"CPack requires NSIS Version 2.09 or greater. "
|
||||||
|
"NSIS found on the system was: "
|
||||||
|
<< nsisVersion << std::endl);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( versionRexCVS.find(output))
|
||||||
|
{
|
||||||
|
// No version check for NSIS cvs build
|
||||||
|
cmCPackLogger(cmCPackLog::LOG_DEBUG, "NSIS Version: CVS "
|
||||||
|
<< versionRexCVS.match(1).c_str() << std::endl);
|
||||||
}
|
}
|
||||||
this->SetOptionIfNotSet("CPACK_INSTALLER_PROGRAM", nsisPath.c_str());
|
this->SetOptionIfNotSet("CPACK_INSTALLER_PROGRAM", nsisPath.c_str());
|
||||||
this->SetOptionIfNotSet("CPACK_NSIS_EXECUTABLES_DIRECTORY", "bin");
|
this->SetOptionIfNotSet("CPACK_NSIS_EXECUTABLES_DIRECTORY", "bin");
|
||||||
|
|
Loading…
Reference in New Issue