[Cmake-commits] CMake branch, next, updated. v2.8.2-765-g8edcf34
Brad King
brad.king at kitware.com
Mon Sep 13 16:21:20 EDT 2010
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 8edcf3432d55a9304534659f4a1d9b2eccbab96f (commit)
via a6b5ead62fb4e69c053d752570f4c8af24e41857 (commit)
from 8e732c6e792863e380cec22ece7bf0ed2101d31a (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=8edcf3432d55a9304534659f4a1d9b2eccbab96f
commit 8edcf3432d55a9304534659f4a1d9b2eccbab96f
Merge: 8e732c6 a6b5ead
Author: Brad King <brad.king at kitware.com>
AuthorDate: Mon Sep 13 16:21:19 2010 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Mon Sep 13 16:21:19 2010 -0400
Merge topic 'improve-missing-source-file-error' into next
a6b5ead Report missing source files with context of target
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a6b5ead62fb4e69c053d752570f4c8af24e41857
commit a6b5ead62fb4e69c053d752570f4c8af24e41857
Author: Brad King <brad.king at kitware.com>
AuthorDate: Mon Sep 13 15:56:06 2010 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Mon Sep 13 16:17:20 2010 -0400
Report missing source files with context of target
Previously we reported only the CMakeLists.txt file in the directory
that adds the target.
diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx
index bc52d7f..b793cd5 100644
--- a/Source/cmSourceFile.cxx
+++ b/Source/cmSourceFile.cxx
@@ -101,11 +101,11 @@ cmSourceFileLocation const& cmSourceFile::GetLocation() const
}
//----------------------------------------------------------------------------
-std::string const& cmSourceFile::GetFullPath()
+std::string const& cmSourceFile::GetFullPath(std::string* error)
{
if(this->FullPath.empty())
{
- if(this->FindFullPath())
+ if(this->FindFullPath(error))
{
this->CheckExtension();
}
@@ -120,7 +120,7 @@ std::string const& cmSourceFile::GetFullPath() const
}
//----------------------------------------------------------------------------
-bool cmSourceFile::FindFullPath()
+bool cmSourceFile::FindFullPath(std::string* error)
{
// If thie method has already failed once do not try again.
if(this->FindFullPathFailed)
@@ -199,7 +199,14 @@ bool cmSourceFile::FindFullPath()
{
e << " ." << *ext;
}
- this->Location.GetMakefile()->IssueMessage(cmake::FATAL_ERROR, e.str());
+ if(error)
+ {
+ *error = e.str();
+ }
+ else
+ {
+ this->Location.GetMakefile()->IssueMessage(cmake::FATAL_ERROR, e.str());
+ }
this->FindFullPathFailed = true;
return false;
}
diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h
index 937e4b7..2dc8488 100644
--- a/Source/cmSourceFile.h
+++ b/Source/cmSourceFile.h
@@ -60,7 +60,7 @@ public:
* horrible interface, but is necessary for backwards
* compatibility).
*/
- std::string const& GetFullPath();
+ std::string const& GetFullPath(std::string* error = 0);
std::string const& GetFullPath() const;
/**
@@ -108,7 +108,7 @@ private:
std::string FullPath;
bool FindFullPathFailed;
- bool FindFullPath();
+ bool FindFullPath(std::string* error);
bool TryFullPath(const char* tryPath, const char* ext);
void CheckExtension();
void CheckLanguage(std::string const& ext);
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 9611912..042371a 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -1439,8 +1439,15 @@ bool cmTarget::FindSourceFiles()
si = this->SourceFiles.begin();
si != this->SourceFiles.end(); ++si)
{
- if((*si)->GetFullPath().empty())
+ std::string e;
+ if((*si)->GetFullPath(&e).empty())
{
+ if(!e.empty())
+ {
+ cmake* cm = this->Makefile->GetCMakeInstance();
+ cm->IssueMessage(cmake::FATAL_ERROR, e,
+ this->GetBacktrace());
+ }
return false;
}
}
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 8e8d0ca..3e92bdf 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -129,6 +129,9 @@ IF(BUILD_TESTING)
ADD_TEST_MACRO(MathTest MathTest)
ADD_TEST_MACRO(Simple Simple)
ADD_TEST_MACRO(PreOrder PreOrder)
+ ADD_TEST_MACRO(MissingSourceFile MissingSourceFile)
+ SET_TESTS_PROPERTIES(MissingSourceFile PROPERTIES
+ PASS_REGULAR_EXPRESSION "CMake Error at CMakeLists.txt:3 \\(add_executable\\):[ \r\n]*Cannot find source file \"MissingSourceFile.c\"")
ADD_TEST_MACRO(COnly COnly)
ADD_TEST_MACRO(CxxOnly CxxOnly)
ADD_TEST_MACRO(IPO COnly/COnly)
diff --git a/Tests/MissingSourceFile/CMakeLists.txt b/Tests/MissingSourceFile/CMakeLists.txt
new file mode 100644
index 0000000..42b7c51
--- /dev/null
+++ b/Tests/MissingSourceFile/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 2.8)
+project(MissingSourceFile C)
+add_executable(MissingSourceFile MissingSourceFile.c)
-----------------------------------------------------------------------
Summary of changes:
Source/cmSourceFile.cxx | 15 +++++++++++----
Source/cmSourceFile.h | 4 ++--
Source/cmTarget.cxx | 9 ++++++++-
Tests/CMakeLists.txt | 3 +++
Tests/MissingSourceFile/CMakeLists.txt | 3 +++
5 files changed, 27 insertions(+), 7 deletions(-)
create mode 100644 Tests/MissingSourceFile/CMakeLists.txt
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list