summaryrefslogtreecommitdiffstats
path: root/Source/cmFileCommand.cxx
diff options
context:
space:
mode:
authorNils Gladitz <nilsgladitz@gmail.com>2017-06-17 16:49:33 (GMT)
committerNils Gladitz <nilsgladitz@gmail.com>2017-06-28 17:55:12 (GMT)
commit5299141320c7be96e9357ebd457c9a279308248a (patch)
tree9c487cff7beef693f711f6bd92ea96f3b9d918c2 /Source/cmFileCommand.cxx
parent1363a0cbcef00cb9a49eba3b68283b5b6d1b95a5 (diff)
downloadCMake-5299141320c7be96e9357ebd457c9a279308248a.zip
CMake-5299141320c7be96e9357ebd457c9a279308248a.tar.gz
CMake-5299141320c7be96e9357ebd457c9a279308248a.tar.bz2
CPackDeb: Enable the DEB generator on Windows
While some features require external Unix tools the generator is mostly portable. By enabling it on Windows it can be used for cross platform packaging.
Diffstat (limited to 'Source/cmFileCommand.cxx')
-rw-r--r--Source/cmFileCommand.cxx41
1 files changed, 28 insertions, 13 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 5777fb2..b769a56 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -55,14 +55,14 @@ class cmSystemToolsFileTime;
static mode_t mode_owner_read = S_IREAD;
static mode_t mode_owner_write = S_IWRITE;
static mode_t mode_owner_execute = S_IEXEC;
-static mode_t mode_group_read = 0;
-static mode_t mode_group_write = 0;
-static mode_t mode_group_execute = 0;
-static mode_t mode_world_read = 0;
-static mode_t mode_world_write = 0;
-static mode_t mode_world_execute = 0;
-static mode_t mode_setuid = 0;
-static mode_t mode_setgid = 0;
+static mode_t mode_group_read = 040;
+static mode_t mode_group_write = 020;
+static mode_t mode_group_execute = 010;
+static mode_t mode_world_read = 04;
+static mode_t mode_world_write = 02;
+static mode_t mode_world_execute = 01;
+static mode_t mode_setuid = 04000;
+static mode_t mode_setgid = 02000;
#else
static mode_t mode_owner_read = S_IRUSR;
static mode_t mode_owner_write = S_IWUSR;
@@ -1076,11 +1076,26 @@ protected:
bool SetPermissions(const char* toFile, mode_t permissions)
{
- if (permissions && !cmSystemTools::SetPermissions(toFile, permissions)) {
- std::ostringstream e;
- e << this->Name << " cannot set permissions on \"" << toFile << "\"";
- this->FileCommand->SetError(e.str());
- return false;
+ if (permissions) {
+#ifdef WIN32
+ if (Makefile->IsOn("CMAKE_CROSSCOMPILING")) {
+ std::string mode_t_adt_filename =
+ std::string(toFile) + ":cmake_mode_t";
+
+ cmsys::ofstream permissionStream(mode_t_adt_filename.c_str());
+
+ if (permissionStream) {
+ permissionStream << std::oct << permissions << std::endl;
+ }
+ }
+#endif
+
+ if (!cmSystemTools::SetPermissions(toFile, permissions)) {
+ std::ostringstream e;
+ e << this->Name << " cannot set permissions on \"" << toFile << "\"";
+ this->FileCommand->SetError(e.str());
+ return false;
+ }
}
return true;
}