summaryrefslogtreecommitdiffstats
path: root/Source/CPack
diff options
context:
space:
mode:
authorEric NOULARD <eric.noulard@gmail.com>2010-08-23 14:14:40 (GMT)
committerEric NOULARD <eric.noulard@gmail.com>2010-08-23 14:14:40 (GMT)
commit40dc97dc73b67d76442b386b73c57437fa72db34 (patch)
tree791ced92f94cc0ff369aba2352576268d46219bc /Source/CPack
parentb718597b8bf50cee6be222915f41294f9fe89f5e (diff)
downloadCMake-40dc97dc73b67d76442b386b73c57437fa72db34.zip
CMake-40dc97dc73b67d76442b386b73c57437fa72db34.tar.gz
CMake-40dc97dc73b67d76442b386b73c57437fa72db34.tar.bz2
CPack Backward-compatibly enforce DESTDIR for DEB and RPM
Diffstat (limited to 'Source/CPack')
-rw-r--r--Source/CPack/cmCPackDebGenerator.cxx5
-rw-r--r--Source/CPack/cmCPackGenerator.cxx16
-rw-r--r--Source/CPack/cmCPackRPMGenerator.cxx6
3 files changed, 23 insertions, 4 deletions
diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx
index 58c6dc3..ac2e151 100644
--- a/Source/CPack/cmCPackDebGenerator.cxx
+++ b/Source/CPack/cmCPackDebGenerator.cxx
@@ -43,7 +43,10 @@ cmCPackDebGenerator::~cmCPackDebGenerator()
int cmCPackDebGenerator::InitializeInternal()
{
this->SetOptionIfNotSet("CPACK_PACKAGING_INSTALL_PREFIX", "/usr");
-
+ if (cmSystemTools::IsOff(this->GetOption("CPACK_SET_DESTDIR")))
+ {
+ this->SetOption("CPACK_SET_DESTDIR", "I_ON");
+ }
return this->Superclass::InitializeInternal();
}
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 4ae2d1f..e44fa7b 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -171,7 +171,8 @@ int cmCPackGenerator::InstallProject()
std::string bareTempInstallDirectory
= this->GetOption("CPACK_TEMPORARY_INSTALL_DIRECTORY");
std::string tempInstallDirectoryStr = bareTempInstallDirectory;
- bool setDestDir = cmSystemTools::IsOn(this->GetOption("CPACK_SET_DESTDIR"));
+ bool setDestDir = cmSystemTools::IsOn(this->GetOption("CPACK_SET_DESTDIR"))
+ | cmSystemTools::IsInternallyOn(this->GetOption("CPACK_SET_DESTDIR"));
if (!setDestDir)
{
tempInstallDirectoryStr += this->GetPackagingInstallPrefix();
@@ -414,7 +415,8 @@ int cmCPackGenerator::InstallProjectViaInstallScript(
// 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;
+
+ std::string dir;
if (this->GetOption("CPACK_INSTALL_PREFIX"))
{
dir += this->GetOption("CPACK_INSTALL_PREFIX");
@@ -643,6 +645,16 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
// value of the project's CMAKE_INSTALL_PREFIX is sent in here as
// the value of the CPACK_INSTALL_PREFIX variable.
//
+ // If DESTDIR has been 'internally set ON' this means that
+ // the underlying CPack specific generator did ask for that
+ // In this case we may overrode CPACK_INSTALL_PREFIX with
+ // CPACK_PACKAGING_INSTALL_PREFIX
+ // I know this is tricky and awkward but it's the price for
+ // CPACK_SET_DESTDIR backward compatibility.
+ if (cmSystemTools::IsInternallyOn(this->GetOption("CPACK_SET_DESTDIR")))
+ {
+ this->SetOption("CPACK_INSTALL_PREFIX",this->GetOption("CPACK_PACKAGING_INSTALL_PREFIX"));
+ }
std::string dir;
if (this->GetOption("CPACK_INSTALL_PREFIX"))
{
diff --git a/Source/CPack/cmCPackRPMGenerator.cxx b/Source/CPack/cmCPackRPMGenerator.cxx
index 01b6b06..0641418 100644
--- a/Source/CPack/cmCPackRPMGenerator.cxx
+++ b/Source/CPack/cmCPackRPMGenerator.cxx
@@ -11,6 +11,7 @@
============================================================================*/
#include "cmCPackRPMGenerator.h"
#include "cmCPackLog.h"
+#include "cmSystemTools.h"
//----------------------------------------------------------------------
cmCPackRPMGenerator::cmCPackRPMGenerator()
@@ -26,7 +27,10 @@ cmCPackRPMGenerator::~cmCPackRPMGenerator()
int cmCPackRPMGenerator::InitializeInternal()
{
this->SetOptionIfNotSet("CPACK_PACKAGING_INSTALL_PREFIX", "/usr");
-
+ if (cmSystemTools::IsOff(this->GetOption("CPACK_SET_DESTDIR")))
+ {
+ this->SetOption("CPACK_SET_DESTDIR", "I_ON");
+ }
return this->Superclass::InitializeInternal();
}