summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/CMakeLists.txt2
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/cmArchiveWrite.cxx19
-rw-r--r--Source/cmArchiveWrite.h2
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx62
-rw-r--r--Source/cmGlobalXCodeGenerator.h6
-rw-r--r--Source/cmSystemTools.cxx3
-rw-r--r--Source/cmSystemTools.h6
-rw-r--r--Source/cm_get_date.c16
-rw-r--r--Source/cm_get_date.h28
-rw-r--r--Source/cmcmd.cxx26
11 files changed, 150 insertions, 22 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 6b6008d..435b654 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -335,6 +335,8 @@ set(SRCS
cmake.cxx
cmake.h
+ cm_get_date.h
+ cm_get_date.c
cm_sha2.h
cm_sha2.c
cm_utf8.h
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index daae107..3dd8e7b 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,5 +1,5 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 1)
-set(CMake_VERSION_PATCH 20150119)
+set(CMake_VERSION_PATCH 20150120)
#set(CMake_VERSION_RC 1)
diff --git a/Source/cmArchiveWrite.cxx b/Source/cmArchiveWrite.cxx
index a2aecac..c24c68e 100644
--- a/Source/cmArchiveWrite.cxx
+++ b/Source/cmArchiveWrite.cxx
@@ -16,6 +16,7 @@
#include <cmsys/Directory.hxx>
#include <cmsys/FStream.hxx>
#include <cm_libarchive.h>
+#include "cm_get_date.h"
//----------------------------------------------------------------------------
static std::string cm_archive_error_string(struct archive* a)
@@ -271,10 +272,26 @@ bool cmArchiveWrite::AddFile(const char* file,
cm_archive_entry_copy_pathname(e, dest);
if(archive_read_disk_entry_from_file(this->Disk, e, -1, 0) != ARCHIVE_OK)
{
- this->Error = "archive_read_disk_entry_from_file: ";
+ this->Error = "archive_read_disk_entry_from_file '";
+ this->Error += file;
+ this->Error += "': ";
this->Error += cm_archive_error_string(this->Disk);
return false;
}
+ if (!this->MTime.empty())
+ {
+ time_t now;
+ time(&now);
+ time_t t = cm_get_date(now, this->MTime.c_str());
+ if (t == -1)
+ {
+ this->Error = "unable to parse mtime '";
+ this->Error += this->MTime;
+ this->Error += "'";
+ return false;
+ }
+ archive_entry_set_mtime(e, t, 0);
+ }
// Clear acl and xattr fields not useful for distribution.
archive_entry_acl_clear(e);
archive_entry_xattr_clear(e);
diff --git a/Source/cmArchiveWrite.h b/Source/cmArchiveWrite.h
index a6dcc0e..17357b4 100644
--- a/Source/cmArchiveWrite.h
+++ b/Source/cmArchiveWrite.h
@@ -74,6 +74,7 @@ public:
// std::cout.
void SetVerbose(bool v) { this->Verbose = v; }
+ void SetMTime(std::string const& t) { this->MTime = t; }
private:
bool Okay() const { return this->Error.empty(); }
bool AddPath(const char* path, size_t skip, const char* prefix);
@@ -90,6 +91,7 @@ private:
struct archive* Disk;
bool Verbose;
std::string Error;
+ std::string MTime;
};
#endif
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 8831a8b..b6c428b 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -969,16 +969,40 @@ struct cmSourceFilePathCompare
};
//----------------------------------------------------------------------------
-void
+struct cmCompareTargets
+{
+ bool operator () (std::string const& a, std::string const& b) const
+ {
+ if (a == "ALL_BUILD")
+ {
+ return true;
+ }
+ if (b == "ALL_BUILD")
+ {
+ return false;
+ }
+ return strcmp(a.c_str(), b.c_str()) < 0;
+ }
+};
+
+//----------------------------------------------------------------------------
+bool
cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
std::vector<cmXCodeObject*>&
targets)
{
this->SetCurrentLocalGenerator(gen);
cmTargets &tgts = this->CurrentMakefile->GetTargets();
+ typedef std::map<std::string, cmTarget*, cmCompareTargets> cmSortedTargets;
+ cmSortedTargets sortedTargets;
for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++)
{
- cmTarget& cmtarget = l->second;
+ sortedTargets[l->first] = &l->second;
+ }
+ for(cmSortedTargets::iterator l = sortedTargets.begin();
+ l != sortedTargets.end(); l++)
+ {
+ cmTarget& cmtarget = *l->second;
cmGeneratorTarget* gtgt = this->GetGeneratorTarget(&cmtarget);
// make sure ALL_BUILD, INSTALL, etc are only done once
@@ -995,7 +1019,12 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
if(cmtarget.GetType() == cmTarget::UTILITY ||
cmtarget.GetType() == cmTarget::GLOBAL_TARGET)
{
- targets.push_back(this->CreateUtilityTarget(cmtarget));
+ cmXCodeObject* t = this->CreateUtilityTarget(cmtarget);
+ if (!t)
+ {
+ return false;
+ }
+ targets.push_back(t);
continue;
}
@@ -1003,7 +1032,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
std::vector<cmSourceFile*> classes;
if (!cmtarget.GetConfigCommonSourceFiles(classes))
{
- return;
+ return false;
}
std::sort(classes.begin(), classes.end(), cmSourceFilePathCompare());
@@ -1230,6 +1259,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
targets.push_back(this->CreateXCodeTarget(cmtarget, buildPhases));
}
+ return true;
}
//----------------------------------------------------------------------------
@@ -2906,7 +2936,7 @@ void cmGlobalXCodeGenerator
}
//----------------------------------------------------------------------------
-void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
+bool cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
std::vector<cmLocalGenerator*>&
generators)
{
@@ -2949,7 +2979,7 @@ void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
std::vector<cmSourceFile*> classes;
if (!cmtarget.GetConfigCommonSourceFiles(classes))
{
- return;
+ return false;
}
// Put cmSourceFile instances in proper groups:
for(std::vector<cmSourceFile*>::const_iterator s = classes.begin();
@@ -2982,6 +3012,7 @@ void cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
}
}
}
+ return true;
}
cmXCodeObject *cmGlobalXCodeGenerator
@@ -3102,7 +3133,7 @@ cmXCodeObject* cmGlobalXCodeGenerator
}
//----------------------------------------------------------------------------
-void cmGlobalXCodeGenerator
+bool cmGlobalXCodeGenerator
::CreateXCodeObjects(cmLocalGenerator* root,
std::vector<cmLocalGenerator*>&
generators)
@@ -3183,7 +3214,10 @@ void cmGlobalXCodeGenerator
this->MainGroupChildren->AddObject(resourcesGroup);
// now create the cmake groups
- this->CreateGroups(root, generators);
+ if (!this->CreateGroups(root, generators))
+ {
+ return false;
+ }
cmXCodeObject* productGroup = this->CreateObject(cmXCodeObject::PBXGroup);
productGroup->AddAttribute("name", this->CreateString("Products"));
@@ -3383,7 +3417,10 @@ void cmGlobalXCodeGenerator
{
if(!this->IsExcluded(root, *i))
{
- this->CreateXCodeTargets(*i, targets);
+ if (!this->CreateXCodeTargets(*i, targets))
+ {
+ return false;
+ }
}
}
// loop over all targets and add link and depend info
@@ -3412,6 +3449,7 @@ void cmGlobalXCodeGenerator
}
}
this->RootObject->AddAttribute("targets", allTargets);
+ return true;
}
//----------------------------------------------------------------------------
@@ -3598,8 +3636,10 @@ cmGlobalXCodeGenerator::OutputXCodeProject(cmLocalGenerator* root,
}
}
- this->CreateXCodeObjects(root,
- generators);
+ if (!this->CreateXCodeObjects(root, generators))
+ {
+ return;
+ }
std::string xcodeDir = root->GetMakefile()->GetStartOutputDirectory();
xcodeDir += "/";
xcodeDir += root->GetMakefile()->GetProjectName();
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index f38435e..a39c8c7 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -91,7 +91,7 @@ private:
cmSourceGroup* sg);
cmXCodeObject* CreatePBXGroup(cmXCodeObject *parent,
std::string name);
- void CreateGroups(cmLocalGenerator* root,
+ bool CreateGroups(cmLocalGenerator* root,
std::vector<cmLocalGenerator*>&
generators);
std::string XCodeEscapePath(const char* p);
@@ -150,7 +150,7 @@ private:
std::string ExtractFlag(const char* flag, std::string& flags);
// delete all objects in the this->XCodeObjects vector.
void ClearXCodeObjects();
- void CreateXCodeObjects(cmLocalGenerator* root,
+ bool CreateXCodeObjects(cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& generators);
void OutputXCodeProject(cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& generators);
@@ -169,7 +169,7 @@ private:
cmXCodeObject* CreateXCodeSourceFile(cmLocalGenerator* gen,
cmSourceFile* sf,
cmTarget& cmtarget);
- void CreateXCodeTargets(cmLocalGenerator* gen,
+ bool CreateXCodeTargets(cmLocalGenerator* gen,
std::vector<cmXCodeObject*>&);
bool IsHeaderFile(cmSourceFile*);
void AddDependTarget(cmXCodeObject* target,
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 7d938c5..e9735ed 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -1469,7 +1469,7 @@ bool cmSystemTools::IsPathToFramework(const char* path)
bool cmSystemTools::CreateTar(const char* outFileName,
const std::vector<std::string>& files,
cmTarCompression compressType,
- bool verbose)
+ bool verbose, std::string const& mtime)
{
#if defined(CMAKE_BUILD_WITH_CMAKE)
std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
@@ -1501,6 +1501,7 @@ bool cmSystemTools::CreateTar(const char* outFileName,
}
cmArchiveWrite a(fout, compress,
cmArchiveWrite::TypeTAR);
+ a.SetMTime(mtime);
a.SetVerbose(verbose);
for(std::vector<std::string>::const_iterator i = files.begin();
i != files.end(); ++i)
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index 09ceea6..361f42e 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -394,9 +394,9 @@ public:
bool verbose);
static bool CreateTar(const char* outFileName,
const std::vector<std::string>& files,
- cmTarCompression compressType, bool verbose);
- static bool ExtractTar(const char* inFileName,
- bool verbose);
+ cmTarCompression compressType, bool verbose,
+ std::string const& mtime = std::string());
+ static bool ExtractTar(const char* inFileName, bool verbose);
// This should be called first thing in main
// it will keep child processes from inheriting the
// stdin and stdout of this process. This is important
diff --git a/Source/cm_get_date.c b/Source/cm_get_date.c
new file mode 100644
index 0000000..2e0d4bd
--- /dev/null
+++ b/Source/cm_get_date.c
@@ -0,0 +1,16 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2015 Kitware, Inc.
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#include "cm_get_date.h"
+
+#define __archive_get_date cm_get_date
+
+#include "../Utilities/cmlibarchive/libarchive/archive_getdate.c"
diff --git a/Source/cm_get_date.h b/Source/cm_get_date.h
new file mode 100644
index 0000000..d5f6d3e
--- /dev/null
+++ b/Source/cm_get_date.h
@@ -0,0 +1,28 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2015 Kitware, Inc.
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#ifndef cm_get_date_h
+#define cm_get_date_h
+
+#include <time.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Parse a date/time string. Treat relative times with respect to 'now'. */
+time_t cm_get_date(time_t now, const char *str);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index ecf4650..7ca3eb3 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -729,9 +729,31 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
std::string flags = args[2];
std::string outFile = args[3];
std::vector<std::string> files;
+ std::string mtime;
+ bool doing_options = true;
for (std::string::size_type cc = 4; cc < args.size(); cc ++)
{
- files.push_back(args[cc]);
+ std::string const& arg = args[cc];
+ if (doing_options && cmHasLiteralPrefix(arg, "--"))
+ {
+ if (arg == "--")
+ {
+ doing_options = false;
+ }
+ else if (cmHasLiteralPrefix(arg, "--mtime="))
+ {
+ mtime = arg.substr(8);
+ }
+ else
+ {
+ cmSystemTools::Error("Unknown option to -E tar: ", arg.c_str());
+ return 1;
+ }
+ }
+ else
+ {
+ files.push_back(arg);
+ }
}
cmSystemTools::cmTarCompression compress =
cmSystemTools::TarCompressNone;
@@ -774,7 +796,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
else if ( flags.find_first_of('c') != flags.npos )
{
if ( !cmSystemTools::CreateTar(
- outFile.c_str(), files, compress, verbose) )
+ outFile.c_str(), files, compress, verbose, mtime) )
{
cmSystemTools::Error("Problem creating tar: ", outFile.c_str());
return 1;