ENH: Add CPACK_SET_DESTDIR handling to enable packaging of installed files in absolute locations. With this setting on, cpack will set the DESTDIR env var when building the package so that files end up in their intended locations. Default behavior is not to set DESTDIR for backwards compatibility. Helps address issue #4993 and issue #5257. Also, remove unused CPACK_USE_DESTDIR variable. ENH: Add variable CPACK_PACKAGING_INSTALL_PREFIX to allow overriding the CPack GetPackagingInstallPrefix from a project's CMakeLists file if necessary. Could be used to remove the annoying /usr prefix still used by default in the Mac PackageMaker generator.
This commit is contained in:
parent
0386e711b8
commit
5beb1da7f7
|
@ -179,7 +179,7 @@ cpack_set_if_not_set(CPACK_OUTPUT_CONFIG_FILE
|
||||||
cpack_set_if_not_set(CPACK_SOURCE_OUTPUT_CONFIG_FILE
|
cpack_set_if_not_set(CPACK_SOURCE_OUTPUT_CONFIG_FILE
|
||||||
"${CMAKE_BINARY_DIR}/CPackSourceConfig.cmake")
|
"${CMAKE_BINARY_DIR}/CPackSourceConfig.cmake")
|
||||||
|
|
||||||
cpack_set_if_not_set(CPACK_USE_DESTDIR ON)
|
cpack_set_if_not_set(CPACK_SET_DESTDIR OFF)
|
||||||
cpack_set_if_not_set(CPACK_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
|
cpack_set_if_not_set(CPACK_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
|
||||||
|
|
||||||
cpack_set_if_not_set(CPACK_NSIS_INSTALLER_ICON_CODE "")
|
cpack_set_if_not_set(CPACK_NSIS_INSTALLER_ICON_CODE "")
|
||||||
|
|
|
@ -41,6 +41,7 @@ cmCPackCygwinBinaryGenerator::~cmCPackCygwinBinaryGenerator()
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int cmCPackCygwinBinaryGenerator::InitializeInternal()
|
int cmCPackCygwinBinaryGenerator::InitializeInternal()
|
||||||
{
|
{
|
||||||
|
this->SetOptionIfNotSet("CPACK_PACKAGING_INSTALL_PREFIX", "/usr");
|
||||||
this->SetOptionIfNotSet("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", "0");
|
this->SetOptionIfNotSet("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", "0");
|
||||||
std::vector<std::string> path;
|
std::vector<std::string> path;
|
||||||
std::string pkgPath = cmSystemTools::FindProgram("bzip2", path, false);
|
std::string pkgPath = cmSystemTools::FindProgram("bzip2", path, false);
|
||||||
|
|
|
@ -34,7 +34,6 @@ public:
|
||||||
cmCPackCygwinBinaryGenerator();
|
cmCPackCygwinBinaryGenerator();
|
||||||
virtual ~cmCPackCygwinBinaryGenerator();
|
virtual ~cmCPackCygwinBinaryGenerator();
|
||||||
protected:
|
protected:
|
||||||
virtual const char* GetInstallPrefix() { return "/usr"; }
|
|
||||||
virtual int InitializeInternal();
|
virtual int InitializeInternal();
|
||||||
int CompressFiles(const char* outFileName, const char* toplevel,
|
int CompressFiles(const char* outFileName, const char* toplevel,
|
||||||
const std::vector<std::string>& files);
|
const std::vector<std::string>& files);
|
||||||
|
|
|
@ -166,7 +166,7 @@ int cmCPackCygwinSourceGenerator::CompressFiles(const char* outFileName,
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* cmCPackCygwinSourceGenerator::GetInstallPrefix()
|
const char* cmCPackCygwinSourceGenerator::GetPackagingInstallPrefix()
|
||||||
{
|
{
|
||||||
this->InstallPrefix = "/";
|
this->InstallPrefix = "/";
|
||||||
this->InstallPrefix += this->GetOption("CPACK_PACKAGE_FILE_NAME");
|
this->InstallPrefix += this->GetOption("CPACK_PACKAGE_FILE_NAME");
|
||||||
|
|
|
@ -34,7 +34,7 @@ public:
|
||||||
cmCPackCygwinSourceGenerator();
|
cmCPackCygwinSourceGenerator();
|
||||||
virtual ~cmCPackCygwinSourceGenerator();
|
virtual ~cmCPackCygwinSourceGenerator();
|
||||||
protected:
|
protected:
|
||||||
const char* GetInstallPrefix();
|
const char* GetPackagingInstallPrefix();
|
||||||
virtual int InitializeInternal();
|
virtual int InitializeInternal();
|
||||||
int CompressFiles(const char* outFileName, const char* toplevel,
|
int CompressFiles(const char* outFileName, const char* toplevel,
|
||||||
const std::vector<std::string>& files);
|
const std::vector<std::string>& files);
|
||||||
|
|
|
@ -42,6 +42,14 @@ cmCPackDebGenerator::~cmCPackDebGenerator()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
int cmCPackDebGenerator::InitializeInternal()
|
||||||
|
{
|
||||||
|
this->SetOptionIfNotSet("CPACK_PACKAGING_INSTALL_PREFIX", "/usr");
|
||||||
|
|
||||||
|
return this->Superclass::InitializeInternal();
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int cmCPackDebGenerator::CompressFiles(const char* outFileName,
|
int cmCPackDebGenerator::CompressFiles(const char* outFileName,
|
||||||
const char* toplevel,
|
const char* toplevel,
|
||||||
|
|
|
@ -37,10 +37,10 @@ public:
|
||||||
virtual ~cmCPackDebGenerator();
|
virtual ~cmCPackDebGenerator();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
virtual int InitializeInternal();
|
||||||
virtual int CompressFiles(const char* outFileName, const char* toplevel,
|
virtual int CompressFiles(const char* outFileName, const char* toplevel,
|
||||||
const std::vector<std::string>& files);
|
const std::vector<std::string>& files);
|
||||||
virtual const char* GetOutputExtension() { return ".deb"; }
|
virtual const char* GetOutputExtension() { return ".deb"; }
|
||||||
virtual const char* GetInstallPrefix() { return "/usr"; }
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,7 @@ void cmCPackGenericGenerator::DisplayVerboseOutput(const char* msg,
|
||||||
int cmCPackGenericGenerator::PrepareNames()
|
int cmCPackGenericGenerator::PrepareNames()
|
||||||
{
|
{
|
||||||
this->SetOption("CPACK_GENERATOR", this->Name.c_str());
|
this->SetOption("CPACK_GENERATOR", this->Name.c_str());
|
||||||
|
|
||||||
std::string tempDirectory = this->GetOption("CPACK_PACKAGE_DIRECTORY");
|
std::string tempDirectory = this->GetOption("CPACK_PACKAGE_DIRECTORY");
|
||||||
tempDirectory += "/_CPack_Packages/";
|
tempDirectory += "/_CPack_Packages/";
|
||||||
const char* toplevelTag = this->GetOption("CPACK_TOPLEVEL_TAG");
|
const char* toplevelTag = this->GetOption("CPACK_TOPLEVEL_TAG");
|
||||||
|
@ -80,7 +81,14 @@ int cmCPackGenericGenerator::PrepareNames()
|
||||||
destFile += "/" + outName;
|
destFile += "/" + outName;
|
||||||
|
|
||||||
std::string outFile = topDirectory + "/" + outName;
|
std::string outFile = topDirectory + "/" + outName;
|
||||||
std::string installPrefix = tempDirectory + this->GetInstallPrefix();
|
|
||||||
|
bool setDestDir = cmSystemTools::IsOn(this->GetOption("CPACK_SET_DESTDIR"));
|
||||||
|
std::string installPrefix = tempDirectory;
|
||||||
|
if (!setDestDir)
|
||||||
|
{
|
||||||
|
installPrefix += this->GetPackagingInstallPrefix();
|
||||||
|
}
|
||||||
|
|
||||||
this->SetOptionIfNotSet("CPACK_TOPLEVEL_DIRECTORY", topDirectory.c_str());
|
this->SetOptionIfNotSet("CPACK_TOPLEVEL_DIRECTORY", topDirectory.c_str());
|
||||||
this->SetOptionIfNotSet("CPACK_TEMPORARY_DIRECTORY", tempDirectory.c_str());
|
this->SetOptionIfNotSet("CPACK_TEMPORARY_DIRECTORY", tempDirectory.c_str());
|
||||||
this->SetOptionIfNotSet("CPACK_OUTPUT_FILE_NAME", outName.c_str());
|
this->SetOptionIfNotSet("CPACK_OUTPUT_FILE_NAME", outName.c_str());
|
||||||
|
@ -147,8 +155,6 @@ int cmCPackGenericGenerator::InstallProject()
|
||||||
this->CleanTemporaryDirectory();
|
this->CleanTemporaryDirectory();
|
||||||
std::string tempInstallDirectoryWithPostfix
|
std::string tempInstallDirectoryWithPostfix
|
||||||
= this->GetOption("CPACK_TEMPORARY_INSTALL_DIRECTORY");
|
= this->GetOption("CPACK_TEMPORARY_INSTALL_DIRECTORY");
|
||||||
tempInstallDirectoryWithPostfix
|
|
||||||
+= this->GetTemporaryInstallDirectoryPostfix();
|
|
||||||
const char* tempInstallDirectory = tempInstallDirectoryWithPostfix.c_str();
|
const char* tempInstallDirectory = tempInstallDirectoryWithPostfix.c_str();
|
||||||
int res = 1;
|
int res = 1;
|
||||||
if ( !cmsys::SystemTools::MakeDirectory(tempInstallDirectory))
|
if ( !cmsys::SystemTools::MakeDirectory(tempInstallDirectory))
|
||||||
|
@ -160,23 +166,23 @@ int cmCPackGenericGenerator::InstallProject()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool movable = true;
|
bool setDestDir = cmSystemTools::IsOn(this->GetOption("CPACK_SET_DESTDIR"));
|
||||||
if ( movable )
|
if ( setDestDir )
|
||||||
{
|
|
||||||
// Make sure there is no destdir
|
|
||||||
cmSystemTools::PutEnv("DESTDIR=");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
std::string destDir = "DESTDIR=";
|
std::string destDir = "DESTDIR=";
|
||||||
destDir += tempInstallDirectory;
|
destDir += tempInstallDirectory;
|
||||||
cmSystemTools::PutEnv(destDir.c_str());
|
cmSystemTools::PutEnv(destDir.c_str());
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Make sure there is no destdir
|
||||||
|
cmSystemTools::PutEnv("DESTDIR=");
|
||||||
|
}
|
||||||
|
|
||||||
// If the CPackConfig file sets CPACK_INSTALL_COMMANDS then run them
|
// If the CPackConfig file sets CPACK_INSTALL_COMMANDS then run them
|
||||||
// as listed
|
// as listed
|
||||||
if ( !this->InstallProjectViaInstallCommands(
|
if ( !this->InstallProjectViaInstallCommands(
|
||||||
movable, tempInstallDirectory) )
|
setDestDir, tempInstallDirectory) )
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -184,7 +190,7 @@ int cmCPackGenericGenerator::InstallProject()
|
||||||
// If the CPackConfig file sets CPACK_INSTALL_SCRIPT then run them
|
// If the CPackConfig file sets CPACK_INSTALL_SCRIPT then run them
|
||||||
// as listed
|
// as listed
|
||||||
if ( !this->InstallProjectViaInstallScript(
|
if ( !this->InstallProjectViaInstallScript(
|
||||||
movable, tempInstallDirectory) )
|
setDestDir, tempInstallDirectory) )
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -193,7 +199,7 @@ int cmCPackGenericGenerator::InstallProject()
|
||||||
// then glob it and copy it to CPACK_TEMPORARY_DIRECTORY
|
// then glob it and copy it to CPACK_TEMPORARY_DIRECTORY
|
||||||
// This is used in Source packageing
|
// This is used in Source packageing
|
||||||
if ( !this->InstallProjectViaInstalledDirectories(
|
if ( !this->InstallProjectViaInstalledDirectories(
|
||||||
movable, tempInstallDirectory) )
|
setDestDir, tempInstallDirectory) )
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -202,12 +208,12 @@ int cmCPackGenericGenerator::InstallProject()
|
||||||
// If the project is a CMAKE project then run pre-install
|
// If the project is a CMAKE project then run pre-install
|
||||||
// and then read the cmake_install script to run it
|
// and then read the cmake_install script to run it
|
||||||
if ( !this->InstallProjectViaInstallCMakeProjects(
|
if ( !this->InstallProjectViaInstallCMakeProjects(
|
||||||
movable, tempInstallDirectory) )
|
setDestDir, tempInstallDirectory) )
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !movable )
|
if ( setDestDir )
|
||||||
{
|
{
|
||||||
cmSystemTools::PutEnv("DESTDIR=");
|
cmSystemTools::PutEnv("DESTDIR=");
|
||||||
}
|
}
|
||||||
|
@ -217,9 +223,9 @@ int cmCPackGenericGenerator::InstallProject()
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int cmCPackGenericGenerator::InstallProjectViaInstallCommands(
|
int cmCPackGenericGenerator::InstallProjectViaInstallCommands(
|
||||||
bool movable, const char* tempInstallDirectory)
|
bool setDestDir, const char* tempInstallDirectory)
|
||||||
{
|
{
|
||||||
(void)movable;
|
(void)setDestDir;
|
||||||
(void)tempInstallDirectory;
|
(void)tempInstallDirectory;
|
||||||
const char* installCommands = this->GetOption("CPACK_INSTALL_COMMANDS");
|
const char* installCommands = this->GetOption("CPACK_INSTALL_COMMANDS");
|
||||||
if ( installCommands && *installCommands )
|
if ( installCommands && *installCommands )
|
||||||
|
@ -261,9 +267,9 @@ int cmCPackGenericGenerator::InstallProjectViaInstallCommands(
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int cmCPackGenericGenerator::InstallProjectViaInstalledDirectories(
|
int cmCPackGenericGenerator::InstallProjectViaInstalledDirectories(
|
||||||
bool movable, const char* tempInstallDirectory)
|
bool setDestDir, const char* tempInstallDirectory)
|
||||||
{
|
{
|
||||||
(void)movable;
|
(void)setDestDir;
|
||||||
(void)tempInstallDirectory;
|
(void)tempInstallDirectory;
|
||||||
std::vector<cmsys::RegularExpression> ignoreFilesRegex;
|
std::vector<cmsys::RegularExpression> ignoreFilesRegex;
|
||||||
const char* cpackIgnoreFiles = this->GetOption("CPACK_IGNORE_FILES");
|
const char* cpackIgnoreFiles = this->GetOption("CPACK_IGNORE_FILES");
|
||||||
|
@ -299,7 +305,6 @@ int cmCPackGenericGenerator::InstallProjectViaInstalledDirectories(
|
||||||
}
|
}
|
||||||
std::vector<std::string>::iterator it;
|
std::vector<std::string>::iterator it;
|
||||||
const char* tempDir = tempInstallDirectory;
|
const char* tempDir = tempInstallDirectory;
|
||||||
// this->GetOption("CPACK_TEMPORARY_DIRECTORY");
|
|
||||||
for ( it = installDirectoriesVector.begin();
|
for ( it = installDirectoriesVector.begin();
|
||||||
it != installDirectoriesVector.end();
|
it != installDirectoriesVector.end();
|
||||||
++it )
|
++it )
|
||||||
|
@ -362,7 +367,7 @@ int cmCPackGenericGenerator::InstallProjectViaInstalledDirectories(
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int cmCPackGenericGenerator::InstallProjectViaInstallScript(
|
int cmCPackGenericGenerator::InstallProjectViaInstallScript(
|
||||||
bool movable, const char* tempInstallDirectory)
|
bool setDestDir, const char* tempInstallDirectory)
|
||||||
{
|
{
|
||||||
const char* cmakeScripts
|
const char* cmakeScripts
|
||||||
= this->GetOption("CPACK_INSTALL_SCRIPT");
|
= this->GetOption("CPACK_INSTALL_SCRIPT");
|
||||||
|
@ -384,10 +389,37 @@ int cmCPackGenericGenerator::InstallProjectViaInstallScript(
|
||||||
|
|
||||||
cmCPackLogger(cmCPackLog::LOG_OUTPUT,
|
cmCPackLogger(cmCPackLog::LOG_OUTPUT,
|
||||||
"- Install script: " << installScript << std::endl);
|
"- Install script: " << installScript << std::endl);
|
||||||
if ( movable )
|
|
||||||
|
if ( setDestDir )
|
||||||
|
{
|
||||||
|
// For DESTDIR based packaging, use the *project* CMAKE_INSTALL_PREFIX
|
||||||
|
// underneath the tempInstallDirectory. The value of the project's
|
||||||
|
// CMAKE_INSTALL_PREFIX is sent in here as the value of the
|
||||||
|
// CPACK_INSTALL_PREFIX variable.
|
||||||
|
std::string dir = tempInstallDirectory;
|
||||||
|
if (this->GetOption("CPACK_INSTALL_PREFIX"))
|
||||||
|
{
|
||||||
|
dir += this->GetOption("CPACK_INSTALL_PREFIX");
|
||||||
|
}
|
||||||
|
this->SetOption("CMAKE_INSTALL_PREFIX", dir.c_str());
|
||||||
|
|
||||||
|
cmCPackLogger(cmCPackLog::LOG_DEBUG,
|
||||||
|
"- Using DESTDIR + CPACK_INSTALL_PREFIX... (this->SetOption)"
|
||||||
|
<< std::endl);
|
||||||
|
cmCPackLogger(cmCPackLog::LOG_DEBUG,
|
||||||
|
"- Setting CMAKE_INSTALL_PREFIX to '" << dir << "'" << std::endl);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
this->SetOption("CMAKE_INSTALL_PREFIX", tempInstallDirectory);
|
this->SetOption("CMAKE_INSTALL_PREFIX", tempInstallDirectory);
|
||||||
|
|
||||||
|
cmCPackLogger(cmCPackLog::LOG_DEBUG,
|
||||||
|
"- Using non-DESTDIR install... (this->SetOption)" << std::endl);
|
||||||
|
cmCPackLogger(cmCPackLog::LOG_DEBUG,
|
||||||
|
"- Setting CMAKE_INSTALL_PREFIX to '" << tempInstallDirectory
|
||||||
|
<< "'" << std::endl);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->SetOptionIfNotSet("CMAKE_CURRENT_BINARY_DIR",
|
this->SetOptionIfNotSet("CMAKE_CURRENT_BINARY_DIR",
|
||||||
tempInstallDirectory);
|
tempInstallDirectory);
|
||||||
this->SetOptionIfNotSet("CMAKE_CURRENT_SOURCE_DIR",
|
this->SetOptionIfNotSet("CMAKE_CURRENT_SOURCE_DIR",
|
||||||
|
@ -404,7 +436,7 @@ int cmCPackGenericGenerator::InstallProjectViaInstallScript(
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int cmCPackGenericGenerator::InstallProjectViaInstallCMakeProjects(
|
int cmCPackGenericGenerator::InstallProjectViaInstallCMakeProjects(
|
||||||
bool movable, const char* tempInstallDirectory)
|
bool setDestDir, const char* tempInstallDirectory)
|
||||||
{
|
{
|
||||||
const char* cmakeProjects
|
const char* cmakeProjects
|
||||||
= this->GetOption("CPACK_INSTALL_CMAKE_PROJECTS");
|
= this->GetOption("CPACK_INSTALL_CMAKE_PROJECTS");
|
||||||
|
@ -517,10 +549,37 @@ int cmCPackGenericGenerator::InstallProjectViaInstallCMakeProjects(
|
||||||
{
|
{
|
||||||
realInstallDirectory += installSubDirectory;
|
realInstallDirectory += installSubDirectory;
|
||||||
}
|
}
|
||||||
if ( movable )
|
|
||||||
|
if ( setDestDir )
|
||||||
|
{
|
||||||
|
// For DESTDIR based packaging, use the *project* CMAKE_INSTALL_PREFIX
|
||||||
|
// underneath the tempInstallDirectory. The value of the project's
|
||||||
|
// CMAKE_INSTALL_PREFIX is sent in here as the value of the
|
||||||
|
// CPACK_INSTALL_PREFIX variable.
|
||||||
|
std::string dir = tempInstallDirectory;
|
||||||
|
if (this->GetOption("CPACK_INSTALL_PREFIX"))
|
||||||
|
{
|
||||||
|
dir += this->GetOption("CPACK_INSTALL_PREFIX");
|
||||||
|
}
|
||||||
|
mf->AddDefinition("CMAKE_INSTALL_PREFIX", dir.c_str());
|
||||||
|
|
||||||
|
cmCPackLogger(cmCPackLog::LOG_DEBUG,
|
||||||
|
"- Using DESTDIR + CPACK_INSTALL_PREFIX... (mf->AddDefinition)"
|
||||||
|
<< std::endl);
|
||||||
|
cmCPackLogger(cmCPackLog::LOG_DEBUG,
|
||||||
|
"- Setting CMAKE_INSTALL_PREFIX to '" << dir << "'" << std::endl);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
mf->AddDefinition("CMAKE_INSTALL_PREFIX", tempInstallDirectory);
|
mf->AddDefinition("CMAKE_INSTALL_PREFIX", tempInstallDirectory);
|
||||||
|
|
||||||
|
cmCPackLogger(cmCPackLog::LOG_DEBUG,
|
||||||
|
"- Using non-DESTDIR install... (mf->AddDefinition)" << std::endl);
|
||||||
|
cmCPackLogger(cmCPackLog::LOG_DEBUG,
|
||||||
|
"- Setting CMAKE_INSTALL_PREFIX to '" << tempInstallDirectory
|
||||||
|
<< "'" << std::endl);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( buildConfig && *buildConfig )
|
if ( buildConfig && *buildConfig )
|
||||||
{
|
{
|
||||||
mf->AddDefinition("BUILD_TYPE", buildConfig);
|
mf->AddDefinition("BUILD_TYPE", buildConfig);
|
||||||
|
@ -701,6 +760,11 @@ int cmCPackGenericGenerator::Initialize(const char* name, cmMakefile* mf,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If a generator subclass did not already set this option in its
|
||||||
|
// InitializeInternal implementation, and the project did not already set
|
||||||
|
// it, the default value should be:
|
||||||
|
this->SetOptionIfNotSet("CPACK_PACKAGING_INSTALL_PREFIX", "/");
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -927,6 +991,15 @@ const char* cmCPackGenericGenerator::GetInstallPath()
|
||||||
return this->InstallPath.c_str();
|
return this->InstallPath.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
const char* cmCPackGenericGenerator::GetPackagingInstallPrefix()
|
||||||
|
{
|
||||||
|
cmCPackLogger(cmCPackLog::LOG_DEBUG, "GetPackagingInstallPrefix: '"
|
||||||
|
<< this->GetOption("CPACK_PACKAGING_INSTALL_PREFIX") << "'" << std::endl);
|
||||||
|
|
||||||
|
return this->GetOption("CPACK_PACKAGING_INSTALL_PREFIX");
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
std::string cmCPackGenericGenerator::FindTemplate(const char* name)
|
std::string cmCPackGenericGenerator::FindTemplate(const char* name)
|
||||||
{
|
{
|
||||||
|
@ -960,8 +1033,6 @@ int cmCPackGenericGenerator::CleanTemporaryDirectory()
|
||||||
{
|
{
|
||||||
std::string tempInstallDirectoryWithPostfix
|
std::string tempInstallDirectoryWithPostfix
|
||||||
= this->GetOption("CPACK_TEMPORARY_INSTALL_DIRECTORY");
|
= this->GetOption("CPACK_TEMPORARY_INSTALL_DIRECTORY");
|
||||||
tempInstallDirectoryWithPostfix
|
|
||||||
+= this->GetTemporaryInstallDirectoryPostfix();
|
|
||||||
const char* tempInstallDirectory = tempInstallDirectoryWithPostfix.c_str();
|
const char* tempInstallDirectory = tempInstallDirectoryWithPostfix.c_str();
|
||||||
if(cmsys::SystemTools::FileExists(tempInstallDirectory))
|
if(cmsys::SystemTools::FileExists(tempInstallDirectory))
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
#ifndef cmCPackGenericGenerator_h
|
#ifndef cmCPackGenericGenerator_h
|
||||||
#define cmCPackGenericGenerator_h
|
#define cmCPackGenericGenerator_h
|
||||||
|
|
||||||
|
|
||||||
#include "cmObject.h"
|
#include "cmObject.h"
|
||||||
|
|
||||||
#define cmCPackTypeMacro(class, superclass) \
|
#define cmCPackTypeMacro(class, superclass) \
|
||||||
|
@ -102,8 +101,7 @@ protected:
|
||||||
virtual int CompressFiles(const char* outFileName, const char* toplevel,
|
virtual int CompressFiles(const char* outFileName, const char* toplevel,
|
||||||
const std::vector<std::string>& files);
|
const std::vector<std::string>& files);
|
||||||
virtual const char* GetInstallPath();
|
virtual const char* GetInstallPath();
|
||||||
virtual const char* GetInstallPrefix() { return "/"; }
|
virtual const char* GetPackagingInstallPrefix();
|
||||||
virtual const char* GetTemporaryInstallDirectoryPostfix() { return ""; }
|
|
||||||
|
|
||||||
virtual std::string FindTemplate(const char* name);
|
virtual std::string FindTemplate(const char* name);
|
||||||
virtual bool ConfigureFile(const char* inName, const char* outName,
|
virtual bool ConfigureFile(const char* inName, const char* outName,
|
||||||
|
@ -114,13 +112,13 @@ protected:
|
||||||
|
|
||||||
//! Run install commands if specified
|
//! Run install commands if specified
|
||||||
virtual int InstallProjectViaInstallCommands(
|
virtual int InstallProjectViaInstallCommands(
|
||||||
bool movable, const char* tempInstallDirectory);
|
bool setDestDir, const char* tempInstallDirectory);
|
||||||
virtual int InstallProjectViaInstallScript(
|
virtual int InstallProjectViaInstallScript(
|
||||||
bool movable, const char* tempInstallDirectory);
|
bool setDestDir, const char* tempInstallDirectory);
|
||||||
virtual int InstallProjectViaInstalledDirectories(
|
virtual int InstallProjectViaInstalledDirectories(
|
||||||
bool movable, const char* tempInstallDirectory);
|
bool setDestDir, const char* tempInstallDirectory);
|
||||||
virtual int InstallProjectViaInstallCMakeProjects(
|
virtual int InstallProjectViaInstallCMakeProjects(
|
||||||
bool movable, const char* tempInstallDirectory);
|
bool setDestDir, const char* tempInstallDirectory);
|
||||||
|
|
||||||
bool GeneratorVerbose;
|
bool GeneratorVerbose;
|
||||||
std::string Name;
|
std::string Name;
|
||||||
|
|
|
@ -178,8 +178,6 @@ int cmCPackOSXX11Generator::InitializeInternal()
|
||||||
this->SetOptionIfNotSet("CPACK_INSTALLER_PROGRAM_DISK_IMAGE",
|
this->SetOptionIfNotSet("CPACK_INSTALLER_PROGRAM_DISK_IMAGE",
|
||||||
pkgPath.c_str());
|
pkgPath.c_str());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return this->Superclass::InitializeInternal();
|
return this->Superclass::InitializeInternal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,6 +226,7 @@ bool cmCPackOSXX11Generator::CopyCreateResourceFile(const char* name)
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
bool cmCPackOSXX11Generator::CopyResourcePlistFile(const char* name,
|
bool cmCPackOSXX11Generator::CopyResourcePlistFile(const char* name,
|
||||||
const char* dir, const char* outputFileName /* = 0 */,
|
const char* dir, const char* outputFileName /* = 0 */,
|
||||||
bool copyOnly /* = false */)
|
bool copyOnly /* = false */)
|
||||||
|
@ -259,7 +258,7 @@ bool cmCPackOSXX11Generator::CopyResourcePlistFile(const char* name,
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
const char* cmCPackOSXX11Generator::GetInstallPrefix()
|
const char* cmCPackOSXX11Generator::GetPackagingInstallPrefix()
|
||||||
{
|
{
|
||||||
this->InstallPrefix = "/";
|
this->InstallPrefix = "/";
|
||||||
this->InstallPrefix += this->GetOption("CPACK_PACKAGE_FILE_NAME");
|
this->InstallPrefix += this->GetOption("CPACK_PACKAGE_FILE_NAME");
|
||||||
|
|
|
@ -40,7 +40,7 @@ protected:
|
||||||
virtual int InitializeInternal();
|
virtual int InitializeInternal();
|
||||||
int CompressFiles(const char* outFileName, const char* toplevel,
|
int CompressFiles(const char* outFileName, const char* toplevel,
|
||||||
const std::vector<std::string>& files);
|
const std::vector<std::string>& files);
|
||||||
virtual const char* GetInstallPrefix();
|
virtual const char* GetPackagingInstallPrefix();
|
||||||
virtual const char* GetOutputExtension() { return ".dmg"; }
|
virtual const char* GetOutputExtension() { return ".dmg"; }
|
||||||
|
|
||||||
//bool CopyCreateResourceFile(const char* name, const char* dir);
|
//bool CopyCreateResourceFile(const char* name, const char* dir);
|
||||||
|
|
|
@ -141,6 +141,7 @@ int cmCPackPackageMakerGenerator::InitializeInternal()
|
||||||
{
|
{
|
||||||
cmCPackLogger(cmCPackLog::LOG_DEBUG,
|
cmCPackLogger(cmCPackLog::LOG_DEBUG,
|
||||||
"cmCPackPackageMakerGenerator::Initialize()" << std::endl);
|
"cmCPackPackageMakerGenerator::Initialize()" << std::endl);
|
||||||
|
this->SetOptionIfNotSet("CPACK_PACKAGING_INSTALL_PREFIX", "/usr");
|
||||||
std::vector<std::string> path;
|
std::vector<std::string> path;
|
||||||
std::string pkgPath
|
std::string pkgPath
|
||||||
= "/Developer/Applications/Utilities/PackageMaker.app/Contents";
|
= "/Developer/Applications/Utilities/PackageMaker.app/Contents";
|
||||||
|
|
|
@ -44,7 +44,6 @@ protected:
|
||||||
const std::vector<std::string>& files);
|
const std::vector<std::string>& files);
|
||||||
virtual const char* GetOutputExtension() { return ".dmg"; }
|
virtual const char* GetOutputExtension() { return ".dmg"; }
|
||||||
virtual const char* GetOutputPostfix() { return "darwin"; }
|
virtual const char* GetOutputPostfix() { return "darwin"; }
|
||||||
virtual const char* GetInstallPrefix() { return "/usr"; }
|
|
||||||
|
|
||||||
bool CopyCreateResourceFile(const char* name);
|
bool CopyCreateResourceFile(const char* name);
|
||||||
bool CopyResourcePlistFile(const char* name);
|
bool CopyResourcePlistFile(const char* name);
|
||||||
|
|
|
@ -27,6 +27,14 @@ cmCPackRPMGenerator::~cmCPackRPMGenerator()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
int cmCPackRPMGenerator::InitializeInternal()
|
||||||
|
{
|
||||||
|
this->SetOptionIfNotSet("CPACK_PACKAGING_INSTALL_PREFIX", "/usr");
|
||||||
|
|
||||||
|
return this->Superclass::InitializeInternal();
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
int cmCPackRPMGenerator::CompressFiles(const char* /*outFileName*/,
|
int cmCPackRPMGenerator::CompressFiles(const char* /*outFileName*/,
|
||||||
const char* /*toplevel*/,
|
const char* /*toplevel*/,
|
||||||
|
|
|
@ -41,10 +41,10 @@ public:
|
||||||
virtual ~cmCPackRPMGenerator();
|
virtual ~cmCPackRPMGenerator();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
virtual int InitializeInternal();
|
||||||
virtual int CompressFiles(const char* outFileName, const char* toplevel,
|
virtual int CompressFiles(const char* outFileName, const char* toplevel,
|
||||||
const std::vector<std::string>& files);
|
const std::vector<std::string>& files);
|
||||||
virtual const char* GetOutputExtension() { return ".rpm"; }
|
virtual const char* GetOutputExtension() { return ".rpm"; }
|
||||||
virtual const char* GetInstallPrefix() { return "/usr"; }
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue