summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorNils Gladitz <nilsgladitz@gmail.com>2018-08-08 06:24:40 (GMT)
committerNils Gladitz <nilsgladitz@gmail.com>2018-08-14 06:37:03 (GMT)
commit4a0f664aafb27a073e0a4856cdff6132f99fe627 (patch)
treedb4af77e78b0635d739ba61577d46d301b5c1b2f /Source
parentbc0b976776f7504d237a5a750ca035b87bdad49f (diff)
downloadCMake-4a0f664aafb27a073e0a4856cdff6132f99fe627.zip
CMake-4a0f664aafb27a073e0a4856cdff6132f99fe627.tar.gz
CMake-4a0f664aafb27a073e0a4856cdff6132f99fe627.tar.bz2
CPackExt: Add CPACK_EXT_ENABLE_STAGING and CPACK_EXT_PACKAGE_SCRIPT
CPACK_EXT_ENABLE_STAGING enables optional staging and CPACK_EXT_PACKAGE_SCRIPT allows to specify an optional script file that can package staged files via an external packaging tool. Issue: #18236
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;
};