[Cmake-commits] CMake branch, next, updated. v3.0.0-rc5-3240-gb9cc7cf
Brad King
brad.king at kitware.com
Tue May 20 11:10:08 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 b9cc7cf7f17ca756da33734285920567e0faccc9 (commit)
via 2c448dbfe762278480bfd4f8ba9f458f9a104941 (commit)
from 4bb54f7ace4fb3a46358d730c9c3f9d03411d649 (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=b9cc7cf7f17ca756da33734285920567e0faccc9
commit b9cc7cf7f17ca756da33734285920567e0faccc9
Merge: 4bb54f7 2c448db
Author: Brad King <brad.king at kitware.com>
AuthorDate: Tue May 20 11:10:07 2014 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue May 20 11:10:07 2014 -0400
Merge topic 'file-command-open-errors' into next
2c448dbf file: Report system error on failure to open file
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2c448dbfe762278480bfd4f8ba9f458f9a104941
commit 2c448dbfe762278480bfd4f8ba9f458f9a104941
Author: Brad King <brad.king at kitware.com>
AuthorDate: Tue May 20 10:42:13 2014 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Tue May 20 11:07:51 2014 -0400
file: Report system error on failure to open file
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 5bfb664..4ee34df 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -232,9 +232,10 @@ bool cmFileCommand::HandleWriteCommand(std::vector<std::string> const& args,
cmsys::ofstream file(fileName.c_str(), append?std::ios::app: std::ios::out);
if ( !file )
{
- std::string error = "Internal CMake error when trying to open file: ";
- error += fileName.c_str();
- error += " for writing.";
+ std::string error = "failed to open for writing (";
+ error += cmSystemTools::GetLastSystemError();
+ error += "):\n ";
+ error += fileName;
this->SetError(error);
return false;
}
@@ -292,9 +293,10 @@ bool cmFileCommand::HandleReadCommand(std::vector<std::string> const& args)
if ( !file )
{
- std::string error = "Internal CMake error when trying to open file: ";
- error += fileName.c_str();
- error += " for reading.";
+ std::string error = "failed to open for reading (";
+ error += cmSystemTools::GetLastSystemError();
+ error += "):\n ";
+ error += fileName;
this->SetError(error);
return false;
}
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 3eeda2f..4efc73a 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -84,6 +84,7 @@ add_RunCMake_test(add_dependencies)
add_RunCMake_test(build_command)
add_RunCMake_test(export)
add_RunCMake_test(cmake_minimum_required)
+add_RunCMake_test(file)
add_RunCMake_test(find_package)
add_RunCMake_test(get_filename_component)
add_RunCMake_test(if)
diff --git a/Tests/RunCMake/file/CMakeLists.txt b/Tests/RunCMake/file/CMakeLists.txt
new file mode 100644
index 0000000..2897109
--- /dev/null
+++ b/Tests/RunCMake/file/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.0)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/file/FileOpenFailRead-result.txt b/Tests/RunCMake/file/FileOpenFailRead-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/file/FileOpenFailRead-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file/FileOpenFailRead-stderr.txt b/Tests/RunCMake/file/FileOpenFailRead-stderr.txt
new file mode 100644
index 0000000..23d4337
--- /dev/null
+++ b/Tests/RunCMake/file/FileOpenFailRead-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error at FileOpenFailRead.cmake:[0-9]+ \(file\):
+ file failed to open for reading \(.*\):
+
+ .*/Tests/RunCMake/file/does_not_exist/file.txt
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/file/FileOpenFailRead.cmake b/Tests/RunCMake/file/FileOpenFailRead.cmake
new file mode 100644
index 0000000..4d4c6dc
--- /dev/null
+++ b/Tests/RunCMake/file/FileOpenFailRead.cmake
@@ -0,0 +1 @@
+file(READ "${CMAKE_CURRENT_SOURCE_DIR}/does_not_exist/file.txt" content)
diff --git a/Tests/RunCMake/file/RunCMakeTest.cmake b/Tests/RunCMake/file/RunCMakeTest.cmake
new file mode 100644
index 0000000..7b05229
--- /dev/null
+++ b/Tests/RunCMake/file/RunCMakeTest.cmake
@@ -0,0 +1,3 @@
+include(RunCMake)
+
+run_cmake(FileOpenFailRead)
-----------------------------------------------------------------------
Summary of changes:
Source/cmFileCommand.cxx | 14 ++++++++------
Tests/RunCMake/CMakeLists.txt | 1 +
Tests/RunCMake/{configure_file => file}/CMakeLists.txt | 0
.../FileOpenFailRead-result.txt} | 0
Tests/RunCMake/file/FileOpenFailRead-stderr.txt | 6 ++++++
Tests/RunCMake/file/FileOpenFailRead.cmake | 1 +
Tests/RunCMake/file/RunCMakeTest.cmake | 3 +++
7 files changed, 19 insertions(+), 6 deletions(-)
copy Tests/RunCMake/{configure_file => file}/CMakeLists.txt (100%)
copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => file/FileOpenFailRead-result.txt} (100%)
create mode 100644 Tests/RunCMake/file/FileOpenFailRead-stderr.txt
create mode 100644 Tests/RunCMake/file/FileOpenFailRead.cmake
create mode 100644 Tests/RunCMake/file/RunCMakeTest.cmake
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list