[Cmake-commits] CMake branch, next, updated. v3.0.0-4420-g2432d11

Stephen Kelly steveire at gmail.com
Tue Jul 22 09:45:38 EDT 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  2432d11a01cdfce3bfbb8d866a5f3a45f200b8dd (commit)
       via  808f0b9ad2f2a4e6584f0f61bb93f4a20633899b (commit)
       via  be4f3bdbf85e88f1225982efd076342c619a7f77 (commit)
       via  1d17926b8a009b7026ae644690c8ec43286139bc (commit)
      from  2031072957ad0de5f4e447f34075d1f95bd609eb (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2432d11a01cdfce3bfbb8d866a5f3a45f200b8dd
commit 2432d11a01cdfce3bfbb8d866a5f3a45f200b8dd
Merge: 2031072 808f0b9
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Jul 22 09:45:37 2014 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Jul 22 09:45:37 2014 -0400

    Merge topic 'file-GENERATE-fixes' into next
    
    808f0b9a file(GENERATE): Use permissions of input file if present.
    be4f3bdb file(GENERATE): Re-run cmake if the output file is removed.
    1d17926b file(GENERATE): Re-run cmake if the input file changes


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=808f0b9ad2f2a4e6584f0f61bb93f4a20633899b
commit 808f0b9ad2f2a4e6584f0f61bb93f4a20633899b
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Jul 22 15:10:57 2014 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Tue Jul 22 15:39:36 2014 +0200

    file(GENERATE): Use permissions of input file if present.

diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx
index f1b19a3..49cdba8 100644
--- a/Source/cmGeneratorExpressionEvaluationFile.cxx
+++ b/Source/cmGeneratorExpressionEvaluationFile.cxx
@@ -36,7 +36,7 @@ cmGeneratorExpressionEvaluationFile::cmGeneratorExpressionEvaluationFile(
 //----------------------------------------------------------------------------
 void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config,
               cmCompiledGeneratorExpression* inputExpression,
-              std::map<std::string, std::string> &outputFiles)
+              std::map<std::string, std::string> &outputFiles, mode_t perm)
 {
   std::string rawCondition = this->Condition->GetInput();
   if (!rawCondition.empty())
@@ -84,11 +84,17 @@ void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config,
   cmGeneratedFileStream fout(outputFileName.c_str());
   fout.SetCopyIfDifferent(true);
   fout << outputContent;
+  if (perm)
+    {
+    fout.close();
+    cmSystemTools::SetPermissions(outputFileName.c_str(), perm);
+    }
 }
 
 //----------------------------------------------------------------------------
 void cmGeneratorExpressionEvaluationFile::Generate()
 {
+  mode_t perm = 0;
   std::string inputContent;
   if (this->InputIsContent)
     {
@@ -96,6 +102,7 @@ void cmGeneratorExpressionEvaluationFile::Generate()
     }
   else
     {
+    cmSystemTools::GetPermissions(this->Input.c_str(), perm);
     this->Makefile->AddCMakeDependFile(this->Input.c_str());
 
     cmsys::ifstream fin(this->Input.c_str());
@@ -134,7 +141,7 @@ void cmGeneratorExpressionEvaluationFile::Generate()
   for(std::vector<std::string>::const_iterator li = allConfigs.begin();
       li != allConfigs.end(); ++li)
     {
-    this->Generate(*li, inputExpression.get(), outputFiles);
+    this->Generate(*li, inputExpression.get(), outputFiles, perm);
     if(cmSystemTools::GetFatalErrorOccured())
       {
       return;
diff --git a/Source/cmGeneratorExpressionEvaluationFile.h b/Source/cmGeneratorExpressionEvaluationFile.h
index f939916..4e87a88 100644
--- a/Source/cmGeneratorExpressionEvaluationFile.h
+++ b/Source/cmGeneratorExpressionEvaluationFile.h
@@ -34,7 +34,7 @@ public:
 private:
   void Generate(const std::string& config,
               cmCompiledGeneratorExpression* inputExpression,
-              std::map<std::string, std::string> &outputFiles);
+              std::map<std::string, std::string> &outputFiles, mode_t perm);
 
 private:
   const std::string Input;

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=be4f3bdbf85e88f1225982efd076342c619a7f77
commit be4f3bdbf85e88f1225982efd076342c619a7f77
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Jul 22 15:37:32 2014 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Tue Jul 22 15:39:36 2014 +0200

    file(GENERATE): Re-run cmake if the output file is removed.

diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx
index 203a577..f1b19a3 100644
--- a/Source/cmGeneratorExpressionEvaluationFile.cxx
+++ b/Source/cmGeneratorExpressionEvaluationFile.cxx
@@ -77,6 +77,7 @@ void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config,
     return;
     }
 
+  this->Makefile->AddCMakeOutputFile(outputFileName.c_str());
   this->Files.push_back(outputFileName);
   outputFiles[outputFileName] = outputContent;
 
diff --git a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake
index 10b8f0b..5752459 100644
--- a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake
+++ b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake
@@ -56,3 +56,11 @@ file(READ "${RunCMake_BINARY_DIR}/ReRunCMake-build/output_file.txt" out_content)
 if(NOT out_content STREQUAL "ChangedContent\n")
   message(SEND_ERROR "File did not change: \"${RunCMake_BINARY_DIR}/ReRunCMake-build/output_file.txt\"")
 endif()
+
+
+file(REMOVE "${RunCMake_BINARY_DIR}/ReRunCMake-build/output_file.txt")
+execute_process(COMMAND ${CMAKE_COMMAND} --build "${RunCMake_BINARY_DIR}/ReRunCMake-build/")
+
+if (NOT EXISTS "${RunCMake_BINARY_DIR}/ReRunCMake-build/output_file.txt")
+  message(SEND_ERROR "File did not re-generate: \"${RunCMake_BINARY_DIR}/ReRunCMake-build/output_file.txt\"")
+endif()

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1d17926b8a009b7026ae644690c8ec43286139bc
commit 1d17926b8a009b7026ae644690c8ec43286139bc
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Jul 22 15:07:39 2014 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Tue Jul 22 15:39:34 2014 +0200

    file(GENERATE): Re-run cmake if the input file changes

diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx
index f9067cf..203a577 100644
--- a/Source/cmGeneratorExpressionEvaluationFile.cxx
+++ b/Source/cmGeneratorExpressionEvaluationFile.cxx
@@ -95,6 +95,8 @@ void cmGeneratorExpressionEvaluationFile::Generate()
     }
   else
     {
+    this->Makefile->AddCMakeDependFile(this->Input.c_str());
+
     cmsys::ifstream fin(this->Input.c_str());
     if(!fin)
       {
diff --git a/Tests/RunCMake/File_Generate/ReRunCMake-result.txt b/Tests/RunCMake/File_Generate/ReRunCMake-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/File_Generate/ReRunCMake-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/File_Generate/ReRunCMake-stderr.txt b/Tests/RunCMake/File_Generate/ReRunCMake-stderr.txt
new file mode 100644
index 0000000..10f3293
--- /dev/null
+++ b/Tests/RunCMake/File_Generate/ReRunCMake-stderr.txt
@@ -0,0 +1 @@
+^$
diff --git a/Tests/RunCMake/File_Generate/ReRunCMake.cmake b/Tests/RunCMake/File_Generate/ReRunCMake.cmake
new file mode 100644
index 0000000..109d60e
--- /dev/null
+++ b/Tests/RunCMake/File_Generate/ReRunCMake.cmake
@@ -0,0 +1,5 @@
+
+file(GENERATE
+  OUTPUT output_file.txt
+  INPUT "${CMAKE_CURRENT_BINARY_DIR}/input_file.txt"
+)
diff --git a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake
index dee0692..10b8f0b 100644
--- a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake
+++ b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake
@@ -35,3 +35,24 @@ unset(RunCMake_TEST_NO_CLEAN)
 if (NOT timestamp_after STREQUAL timestamp)
   message(SEND_ERROR "WriteIfDifferent changed output file.")
 endif()
+
+file(MAKE_DIRECTORY "${RunCMake_BINARY_DIR}/ReRunCMake-build/")
+file(WRITE "${RunCMake_BINARY_DIR}/ReRunCMake-build/input_file.txt" "InitialContent\n")
+
+set(RunCMake_TEST_NO_CLEAN ON)
+run_cmake(ReRunCMake)
+unset(RunCMake_TEST_NO_CLEAN)
+file(TIMESTAMP "${RunCMake_BINARY_DIR}/ReRunCMake-build/output_file.txt" timestamp ${timeformat})
+if(NOT timestamp)
+  message(SEND_ERROR "Could not get timestamp for \"${RunCMake_BINARY_DIR}/ReRunCMake-build/output_file.txt\"")
+endif()
+
+execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 1)
+
+file(WRITE "${RunCMake_BINARY_DIR}/ReRunCMake-build/input_file.txt" "ChangedContent\n")
+execute_process(COMMAND ${CMAKE_COMMAND} --build "${RunCMake_BINARY_DIR}/ReRunCMake-build/")
+file(READ "${RunCMake_BINARY_DIR}/ReRunCMake-build/output_file.txt" out_content)
+
+if(NOT out_content STREQUAL "ChangedContent\n")
+  message(SEND_ERROR "File did not change: \"${RunCMake_BINARY_DIR}/ReRunCMake-build/output_file.txt\"")
+endif()

-----------------------------------------------------------------------

Summary of changes:
 Source/cmGeneratorExpressionEvaluationFile.cxx     |   14 ++++++++--
 Source/cmGeneratorExpressionEvaluationFile.h       |    2 +-
 .../ReRunCMake-result.txt}                         |    0
 .../ReRunCMake-stderr.txt}                         |    0
 Tests/RunCMake/File_Generate/ReRunCMake.cmake      |    5 ++++
 Tests/RunCMake/File_Generate/RunCMakeTest.cmake    |   29 ++++++++++++++++++++
 6 files changed, 47 insertions(+), 3 deletions(-)
 copy Tests/RunCMake/{CMP0022/CMP0022-WARN-empty-old-result.txt => File_Generate/ReRunCMake-result.txt} (100%)
 copy Tests/RunCMake/{CMP0022/CMP0022-NOWARN-exe-stderr.txt => File_Generate/ReRunCMake-stderr.txt} (100%)
 create mode 100644 Tests/RunCMake/File_Generate/ReRunCMake.cmake


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list