[Cmake-commits] CMake branch, next, updated. v3.1.0-rc2-732-g000dc4c
Stephen Kelly
steveire at gmail.com
Tue Nov 18 18:19:25 EST 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 000dc4c2141e7bae14b677137b8771b469d00ae1 (commit)
via 26e98c34dc2a1414f79b6a12de3c4ca060af7578 (commit)
from 66fe82a3adaa0c354c9907371f17c9caa0471e85 (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=000dc4c2141e7bae14b677137b8771b469d00ae1
commit 000dc4c2141e7bae14b677137b8771b469d00ae1
Merge: 66fe82a 26e98c3
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Nov 18 18:19:24 2014 -0500
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Nov 18 18:19:24 2014 -0500
Merge topic 'file-GENERATE-rerun' into next
26e98c34 file(GENERATE): Re-run cmake when appropriate.
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=26e98c34dc2a1414f79b6a12de3c4ca060af7578
commit 26e98c34dc2a1414f79b6a12de3c4ca060af7578
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Jul 22 15:07:39 2014 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Nov 19 00:19:09 2014 +0100
file(GENERATE): Re-run cmake when appropriate.
Re-run if the input file changes or if the output file is removed.
This only works with the Makefile generators currently. The limitation
of the Ninja generator is tracked as issue #15256. The IDE
generators will need larger refactoring as they currently rely on
being able to determine the depends and output files at the start of
generate-time, which is too early for the file(GENERATE) case.
diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx
index 1a101dd..03d0bc6 100644
--- a/Source/cmGeneratorExpressionEvaluationFile.cxx
+++ b/Source/cmGeneratorExpressionEvaluationFile.cxx
@@ -80,6 +80,7 @@ void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config,
return;
}
+ this->Makefile->AddCMakeOutputFile(outputFileName.c_str());
this->Files.push_back(outputFileName);
outputFiles[outputFileName] = outputContent;
@@ -117,6 +118,7 @@ void cmGeneratorExpressionEvaluationFile::Generate()
}
else
{
+ this->Makefile->AddCMakeDependFile(this->Input.c_str());
cmSystemTools::GetPermissions(this->Input.c_str(), perm);
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 7db77d4..97f93d5 100644
--- a/Tests/RunCMake/File_Generate/RunCMakeTest.cmake
+++ b/Tests/RunCMake/File_Generate/RunCMakeTest.cmake
@@ -61,3 +61,34 @@ if (UNIX AND EXISTS /bin/sh)
message(SEND_ERROR "Generated script did not execute correctly:\n${script_output}\n====\n${script_error}")
endif()
endif()
+
+if (RunCMake_GENERATOR MATCHES Makefiles)
+ 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()
+
+
+ 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()
+endif()
-----------------------------------------------------------------------
Summary of changes:
Source/cmGeneratorExpressionEvaluationFile.cxx | 2 ++
.../ReRunCMake-result.txt} | 0
.../ReRunCMake-stderr.txt} | 0
Tests/RunCMake/File_Generate/ReRunCMake.cmake | 5 ++++
Tests/RunCMake/File_Generate/RunCMakeTest.cmake | 31 ++++++++++++++++++++
5 files changed, 38 insertions(+)
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