summaryrefslogtreecommitdiffstats
path: root/Source/CPack
diff options
context:
space:
mode:
authorEric NOULARD <eric.noulard@gmail.com>2012-05-14 18:26:15 (GMT)
committerEric NOULARD <eric.noulard@gmail.com>2012-05-14 18:26:15 (GMT)
commit6ba055bacdce1cdf7a74008b980440027f275d94 (patch)
tree7f87b68f65c72a058dfd4cf544409fef0f7ecba9 /Source/CPack
parent75c0304a9ee646c8a408f713477fa3522ab1e8a8 (diff)
downloadCMake-6ba055bacdce1cdf7a74008b980440027f275d94.zip
CMake-6ba055bacdce1cdf7a74008b980440027f275d94.tar.gz
CMake-6ba055bacdce1cdf7a74008b980440027f275d94.tar.bz2
CPack add easy possibility to warn about CPACK_SET_DESTDIR
CPackNSIS will only warn but sooner or later it should error out
Diffstat (limited to 'Source/CPack')
-rw-r--r--Source/CPack/cmCPackGenerator.cxx32
-rw-r--r--Source/CPack/cmCPackGenerator.h23
-rw-r--r--Source/CPack/cmCPackNSISGenerator.cxx8
-rw-r--r--Source/CPack/cmCPackNSISGenerator.h1
4 files changed, 63 insertions, 1 deletions
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 0f832b3..bf65271 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -62,10 +62,31 @@ void cmCPackGenerator::DisplayVerboseOutput(const char* msg,
//----------------------------------------------------------------------
int cmCPackGenerator::PrepareNames()
-{
+{
cmCPackLogger(cmCPackLog::LOG_DEBUG,
"Create temp directory." << std::endl);
+ // checks CPACK_SET_DESTDIR support
+ if (IsOn("CPACK_SET_DESTDIR"))
+ {
+ if (SETDESTDIR_UNSUPPORTED==SupportsSetDestdir())
+ {
+ cmCPackLogger(cmCPackLog::LOG_ERROR,
+ "CPACK_SET_DESTDIR is set to ON but the '"
+ << Name << "' generator does NOT support it."
+ << std::endl);
+ return 0;
+ }
+ else if (SETDESTDIR_SHOULD_NOT_BE_USED==SupportsSetDestdir())
+ {
+ cmCPackLogger(cmCPackLog::LOG_WARNING,
+ "CPACK_SET_DESTDIR is set to ON but it is "
+ << "usually a bad idea to do that with '"
+ << Name << "' generator. Use at your own risk."
+ << std::endl);
+ }
+ }
+
std::string tempDirectory = this->GetOption("CPACK_PACKAGE_DIRECTORY");
tempDirectory += "/_CPack_Packages/";
const char* toplevelTag = this->GetOption("CPACK_TOPLEVEL_TAG");
@@ -953,6 +974,8 @@ int cmCPackGenerator::DoPackage()
cmCPackLogger(cmCPackLog::LOG_OUTPUT,
"Create package using " << this->Name.c_str() << std::endl);
+ // Prepare CPack internal name and check
+ // values for many CPACK_xxx vars
if ( !this->PrepareNames() )
{
return 0;
@@ -1431,6 +1454,13 @@ std::string cmCPackGenerator::GetComponentPackageFileName(
}
//----------------------------------------------------------------------
+enum cmCPackGenerator::CPackSetDestdirSupport
+cmCPackGenerator::SupportsSetDestdir() const
+{
+ return cmCPackGenerator::SETDESTDIR_SUPPORTED;
+}
+
+//----------------------------------------------------------------------
bool cmCPackGenerator::SupportsComponentInstallation() const
{
return false;
diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h
index 55afb44..68ee3f2 100644
--- a/Source/CPack/cmCPackGenerator.h
+++ b/Source/CPack/cmCPackGenerator.h
@@ -190,6 +190,29 @@ protected:
bool setDestDir, const char* tempInstallDirectory);
/**
+ * The various level of support of
+ * CPACK_SET_DESTDIR used by the generator.
+ */
+ enum CPackSetDestdirSupport {
+ /* the generator works with or without it */
+ SETDESTDIR_SUPPORTED,
+ /* the generator works best if automatically handled */
+ SETDESTDIR_INTERNALLY_SUPPORTED,
+ /* no official support, use at your own risk */
+ SETDESTDIR_SHOULD_NOT_BE_USED,
+ /* officially NOT supported */
+ SETDESTDIR_UNSUPPORTED
+ };
+
+ /**
+ * Does the CPack generator support CPACK_SET_DESTDIR?
+ * The default legacy value is 'true' generator
+ * have to override it in order change this.
+ * @return CPackSetDestdirSupport
+ */
+ virtual enum CPackSetDestdirSupport SupportsSetDestdir() const;
+
+ /**
* Does the CPack generator support component installation?.
* Some Generators requires the user to set
* CPACK_<GENNAME>_COMPONENT_INSTALL in order to make this
diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx
index 0787ef9..63189de 100644
--- a/Source/CPack/cmCPackNSISGenerator.cxx
+++ b/Source/CPack/cmCPackNSISGenerator.cxx
@@ -64,6 +64,7 @@ int cmCPackNSISGenerator::PackageFiles()
<< std::endl);
return false;
}
+
std::string nsisFileName = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
std::string tmpFile = nsisFileName;
tmpFile += "/NSISOutput.log";
@@ -631,6 +632,13 @@ bool cmCPackNSISGenerator::GetListOfSubdirectories(const char* topdir,
}
//----------------------------------------------------------------------
+enum cmCPackGenerator::CPackSetDestdirSupport
+cmCPackNSISGenerator::SupportsSetDestdir() const
+{
+ return cmCPackGenerator::SETDESTDIR_SHOULD_NOT_BE_USED;
+}
+
+//----------------------------------------------------------------------
bool cmCPackNSISGenerator::SupportsComponentInstallation() const
{
return true;
diff --git a/Source/CPack/cmCPackNSISGenerator.h b/Source/CPack/cmCPackNSISGenerator.h
index 7bccb89..c2987d0 100644
--- a/Source/CPack/cmCPackNSISGenerator.h
+++ b/Source/CPack/cmCPackNSISGenerator.h
@@ -44,6 +44,7 @@ protected:
bool GetListOfSubdirectories(const char* dir,
std::vector<std::string>& dirs);
+ enum cmCPackGenerator::CPackSetDestdirSupport SupportsSetDestdir() const;
virtual bool SupportsComponentInstallation() const;
/// Produce a string that contains the NSIS code to describe a