summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-08-30 13:24:23 (GMT)
committerKitware Robot <kwrobot@kitware.com>2018-08-30 13:24:31 (GMT)
commitb11e021bed6d406e3a7b9af6f5ef8fa5565881af (patch)
tree16d9b563cff8a6362c26c003458a21834d8c6747 /Source
parente3a521f02bc1d6353581a1a58ae88bb0a432f165 (diff)
parent4a0f664aafb27a073e0a4856cdff6132f99fe627 (diff)
downloadCMake-b11e021bed6d406e3a7b9af6f5ef8fa5565881af.zip
CMake-b11e021bed6d406e3a7b9af6f5ef8fa5565881af.tar.gz
CMake-b11e021bed6d406e3a7b9af6f5ef8fa5565881af.tar.bz2
Merge topic 'cpack-ext-stage-and-run'
4a0f664aaf CPackExt: Add CPACK_EXT_ENABLE_STAGING and CPACK_EXT_PACKAGE_SCRIPT Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !2272
Diffstat (limited to 'Source')
-rw-r--r--Source/CPack/cmCPackExtGenerator.cxx70
-rw-r--r--Source/CPack/cmCPackExtGenerator.h2
-rw-r--r--Source/CPack/cmCPackGenerator.h1
3 files changed, 52 insertions, 21 deletions
diff --git a/Source/CPack/cmCPackExtGenerator.cxx b/Source/CPack/cmCPackExtGenerator.cxx
index c36b098..4c560b9 100644
--- a/Source/CPack/cmCPackExtGenerator.cxx
+++ b/Source/CPack/cmCPackExtGenerator.cxx
@@ -5,6 +5,7 @@
#include "cmAlgorithms.h"
#include "cmCPackComponentGroup.h"
#include "cmCPackLog.h"
+#include "cmMakefile.h"
#include "cmSystemTools.h"
#include "cm_jsoncpp_value.h"
@@ -56,6 +57,23 @@ int cmCPackExtGenerator::PackageFiles()
return 0;
}
+ const char* packageScript = this->GetOption("CPACK_EXT_PACKAGE_SCRIPT");
+ if (packageScript && *packageScript) {
+ if (!cmSystemTools::FileIsFullPath(packageScript)) {
+ cmCPackLogger(
+ cmCPackLog::LOG_ERROR,
+ "CPACK_EXT_PACKAGE_SCRIPT does not contain a full file path"
+ << std::endl);
+ return 0;
+ }
+
+ int res = this->MakefileMap->ReadListFile(packageScript);
+
+ if (cmSystemTools::GetErrorOccuredFlag() || !res) {
+ return 0;
+ }
+ }
+
return 1;
}
@@ -67,16 +85,22 @@ bool cmCPackExtGenerator::SupportsComponentInstallation() const
int cmCPackExtGenerator::InstallProjectViaInstallCommands(
bool setDestDir, const std::string& tempInstallDirectory)
{
- (void)setDestDir;
- (void)tempInstallDirectory;
+ if (this->StagingEnabled()) {
+ return cmCPackGenerator::InstallProjectViaInstallCommands(
+ setDestDir, tempInstallDirectory);
+ }
+
return 1;
}
int cmCPackExtGenerator::InstallProjectViaInstallScript(
bool setDestDir, const std::string& tempInstallDirectory)
{
- (void)setDestDir;
- (void)tempInstallDirectory;
+ if (this->StagingEnabled()) {
+ return cmCPackGenerator::InstallProjectViaInstallScript(
+ setDestDir, tempInstallDirectory);
+ }
+
return 1;
}
@@ -84,9 +108,11 @@ int cmCPackExtGenerator::InstallProjectViaInstalledDirectories(
bool setDestDir, const std::string& tempInstallDirectory,
const mode_t* default_dir_mode)
{
- (void)setDestDir;
- (void)tempInstallDirectory;
- (void)default_dir_mode;
+ if (this->StagingEnabled()) {
+ return cmCPackGenerator::InstallProjectViaInstalledDirectories(
+ setDestDir, tempInstallDirectory, default_dir_mode);
+ }
+
return 1;
}
@@ -94,10 +120,11 @@ int cmCPackExtGenerator::RunPreinstallTarget(
const std::string& installProjectName, const std::string& installDirectory,
cmGlobalGenerator* globalGenerator, const std::string& buildConfig)
{
- (void)installProjectName;
- (void)installDirectory;
- (void)globalGenerator;
- (void)buildConfig;
+ if (this->StagingEnabled()) {
+ return cmCPackGenerator::RunPreinstallTarget(
+ installProjectName, installDirectory, globalGenerator, buildConfig);
+ }
+
return 1;
}
@@ -108,18 +135,21 @@ int cmCPackExtGenerator::InstallCMakeProject(
const std::string& installSubDirectory, const std::string& buildConfig,
std::string& absoluteDestFiles)
{
- (void)setDestDir;
- (void)installDirectory;
- (void)baseTempInstallDirectory;
- (void)default_dir_mode;
- (void)component;
- (void)componentInstall;
- (void)installSubDirectory;
- (void)buildConfig;
- (void)absoluteDestFiles;
+ if (this->StagingEnabled()) {
+ return cmCPackGenerator::InstallCMakeProject(
+ setDestDir, installDirectory, baseTempInstallDirectory, default_dir_mode,
+ component, componentInstall, installSubDirectory, buildConfig,
+ absoluteDestFiles);
+ }
+
return 1;
}
+bool cmCPackExtGenerator::StagingEnabled() const
+{
+ return !cmSystemTools::IsOff(this->GetOption("CPACK_EXT_ENABLE_STAGING"));
+}
+
cmCPackExtGenerator::cmCPackExtVersionGenerator::cmCPackExtVersionGenerator(
cmCPackExtGenerator* parent)
: Parent(parent)
diff --git a/Source/CPack/cmCPackExtGenerator.h b/Source/CPack/cmCPackExtGenerator.h
index fa12d7f..103e56d 100644
--- a/Source/CPack/cmCPackExtGenerator.h
+++ b/Source/CPack/cmCPackExtGenerator.h
@@ -52,6 +52,8 @@ protected:
std::string& absoluteDestFiles) override;
private:
+ bool StagingEnabled() const;
+
class cmCPackExtVersionGenerator
{
public:
diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h
index c13c649..4755f94 100644
--- a/Source/CPack/cmCPackGenerator.h
+++ b/Source/CPack/cmCPackGenerator.h
@@ -321,7 +321,6 @@ protected:
bool Trace;
bool TraceExpand;
-private:
cmMakefile* MakefileMap;
};