diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index 1fade0761..19eafac2c 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -76,7 +76,8 @@ bool cmListFileCache::CacheFile(const char* path) cmListFileFunction inFunction; if(cmSystemTools::ParseFunction(fin, inFunction.m_Name, - inFunction.m_Arguments)) + inFunction.m_Arguments, + path)) { inFile.m_Functions.push_back(inFunction); } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index f3e777e01..760fe36f7 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -256,7 +256,9 @@ void cmMakefile::ExecuteCommand(std::string &name, } else { - cmSystemTools::Error("unknown CMake command ", name.c_str()); + cmSystemTools::Error("unknown CMake command:", name.c_str(), + "\nReading cmake file in directory:" , + m_cmCurrentDirectory.c_str()); } } diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 0e5c81e2f..a7df5bffe 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -486,7 +486,8 @@ const char *cmSystemTools::ConvertToWindowsSlashesAndCleanUp(std::string& path) bool cmSystemTools::ParseFunction(std::ifstream& fin, std::string& name, - std::vector& arguments) + std::vector& arguments, + const char* filename) { name = ""; arguments = std::vector(); @@ -551,8 +552,8 @@ bool cmSystemTools::ParseFunction(std::ifstream& fin, } else { - cmSystemTools::Error("Parse error in read function missing end )", - inbuffer); + cmSystemTools::Error("Parse error in read function missing end )\nIn File: ", + filename, "\nCurrent line:", inbuffer); return false; } } @@ -560,7 +561,8 @@ bool cmSystemTools::ParseFunction(std::ifstream& fin, } else { - cmSystemTools::Error("Parse error in read function ", inbuffer); + cmSystemTools::Error("Parse error in read function\nIn file:", + filename, "\nCurrent line:", inbuffer); return false; } } diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index b724bc7ff..2f03f473e 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -122,11 +122,13 @@ public: /** * Read a CMake command (or function) from an input file. This * returns the name of the function and a list of its - * arguments. + * arguments. The last argument is the name of the file that + * the ifstream points to, and is used for debug info only. */ static bool ParseFunction(std::ifstream&, std::string& name, - std::vector& arguments); + std::vector& arguments, + const char* filename); /** * Extract white-space separated arguments from a string. diff --git a/Source/ctest.cxx b/Source/ctest.cxx index 8395b1e32..24cf66657 100644 --- a/Source/ctest.cxx +++ b/Source/ctest.cxx @@ -109,7 +109,7 @@ void ctest::ProcessDirectory(int &passed, int &failed) while ( fin ) { - if(cmSystemTools::ParseFunction(fin, name, args)) + if(cmSystemTools::ParseFunction(fin, name, args, "DartTestfile.txt")) { if (name == "SUBDIRS") {