CPack: look for makensis in the PATH (#8210)
Previously, we would search in the Windows registry for the path to makensis, and fail immediately if we could not read the registry value, assuming that it was simply not installed. This change looks for makensis in the PATH even if the registry value is not there, enabling the scenario where makensis is installed without admin privileges and never even touches HKEY_LOCAL_MACHINE during the non-admin install.
This commit is contained in:
parent
d11c70295b
commit
cd9aa73f3a
|
@ -337,6 +337,7 @@ int cmCPackNSISGenerator::InitializeInternal()
|
||||||
<< std::endl);
|
<< std::endl);
|
||||||
std::vector<std::string> path;
|
std::vector<std::string> path;
|
||||||
std::string nsisPath;
|
std::string nsisPath;
|
||||||
|
bool gotRegValue = true;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if ( !cmsys::SystemTools::ReadRegistryValue(
|
if ( !cmsys::SystemTools::ReadRegistryValue(
|
||||||
|
@ -346,24 +347,37 @@ int cmCPackNSISGenerator::InitializeInternal()
|
||||||
if ( !cmsys::SystemTools::ReadRegistryValue(
|
if ( !cmsys::SystemTools::ReadRegistryValue(
|
||||||
"HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS", nsisPath) )
|
"HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS", nsisPath) )
|
||||||
{
|
{
|
||||||
cmCPackLogger
|
gotRegValue = false;
|
||||||
(cmCPackLog::LOG_ERROR,
|
|
||||||
"Cannot find NSIS registry value. This is usually caused by NSIS "
|
|
||||||
"not being installed. Please install NSIS from "
|
|
||||||
"http://nsis.sourceforge.net"
|
|
||||||
<< std::endl);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (gotRegValue)
|
||||||
|
{
|
||||||
path.push_back(nsisPath);
|
path.push_back(nsisPath);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
nsisPath = cmSystemTools::FindProgram("makensis", path, false);
|
nsisPath = cmSystemTools::FindProgram("makensis", path, false);
|
||||||
|
|
||||||
if ( nsisPath.empty() )
|
if ( nsisPath.empty() )
|
||||||
{
|
{
|
||||||
cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find NSIS compiler"
|
cmCPackLogger(cmCPackLog::LOG_ERROR,
|
||||||
|
"Cannot find NSIS compiler makensis: likely it is not installed, "
|
||||||
|
"or not in your PATH"
|
||||||
<< std::endl);
|
<< std::endl);
|
||||||
|
|
||||||
|
if (!gotRegValue)
|
||||||
|
{
|
||||||
|
cmCPackLogger(cmCPackLog::LOG_ERROR,
|
||||||
|
"Could not read NSIS registry value. This is usually caused by "
|
||||||
|
"NSIS not being installed. Please install NSIS from "
|
||||||
|
"http://nsis.sourceforge.net"
|
||||||
|
<< std::endl);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string nsisCmd = "\"" + nsisPath + "\" " NSIS_OPT "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);
|
||||||
|
|
Loading…
Reference in New Issue