diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2008-03-12 21:06:32 -0400 |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2008-03-12 21:06:32 -0400 |
commit | 5ab6c0f0ed39136bd778a6f982691e5142a7aceb (patch) | |
tree | 69b11472960aa7b64dea7527c42526a66671c197 | |
parent | 8bf388109d1d95d1f269b6e78c90e88f217bafa3 (diff) | |
download | cmake-5ab6c0f0ed39136bd778a6f982691e5142a7aceb.tar.gz |
ENH: remove abort calls and replace with an IssueMessage INTERANL_ERROR, better to not crash on the end user.
-rw-r--r-- | Source/cmLocalUnixMakefileGenerator3.cxx | 5 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 9 | ||||
-rw-r--r-- | Source/cmSourceFileLocation.cxx | 8 | ||||
-rw-r--r-- | Source/cmTarget.cxx | 38 | ||||
-rw-r--r-- | Source/cmake.h | 1 |
5 files changed, 52 insertions, 9 deletions
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 158a019705..fc5acc9ab2 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1915,7 +1915,10 @@ cmLocalUnixMakefileGenerator3 // Make sure we never hit this old case. if(source.GetProperty("MACOSX_PACKAGE_LOCATION")) { - abort(); + std::string msg = "MACOSX_PACKAGE_LOCATION set on source file: "; + msg += source.GetFullPath(); + this->GetMakefile()->IssueMessage(cmake::INTERNAL_ERROR, + msg.c_str()); } // Start with the target directory. diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index c39599d711..1960f044bd 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -295,6 +295,11 @@ void cmMakefile::IssueMessage(cmake::MessageType t, isError = true; msg << "CMake Error:"; } + else if(t == cmake::INTERNAL_ERROR) + { + isError = true; + msg << "CMake Internal Error, please report a bug: "; + } else { msg << "CMake Warning"; @@ -2029,7 +2034,9 @@ const char *cmMakefile::ExpandVariablesInString(std::string& source, { // This case should never be called. At-only is for // configure-file/string which always does no escapes. - abort(); + this->IssueMessage(cmake::INTERNAL_ERROR, + "ExpandVariablesInString @ONLY called " + "on something with escapes."); } // Store an original copy of the input. diff --git a/Source/cmSourceFileLocation.cxx b/Source/cmSourceFileLocation.cxx index 159f22f6b6..71c2f8f8e8 100644 --- a/Source/cmSourceFileLocation.cxx +++ b/Source/cmSourceFileLocation.cxx @@ -173,7 +173,13 @@ bool cmSourceFileLocation::Matches(cmSourceFileLocation const& loc) // Each side has a directory relative to a different location. // This can occur when referencing a source file from a different // directory. This is not yet allowed. - abort(); + this->Makefile-> + IssueMessage(cmake::INTERNAL_ERROR, + "Matches error: Each side has a directory relative to a different" + " location. This can occur when referencing a " + "source file from a different directory. " + "This is not yet allowed."); + return false; } else if(this->AmbiguousDirectory) { diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 33c3032225..2d650acb45 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -643,7 +643,11 @@ void cmTarget::SetType(TargetType type, const char* name) type == cmTarget::INSTALL_PROGRAMS || type == cmTarget::INSTALL_DIRECTORY) { - abort(); + this->Makefile-> + IssueMessage(cmake::INTERNAL_ERROR, + "SetType called on cmTarget for INSTALL_FILES, " + "INSTALL_PROGRAMS, or INSTALL_DIRECTORY "); + return; } // only add dependency information for library targets this->TargetTypeValue = type; @@ -2099,7 +2103,11 @@ std::string cmTarget::NormalGetRealName(const char* config) // enforcement of the limited imported target API. if(this->IsImported()) { - abort(); + std::string msg = "NormalGetRealName called on imported target: "; + msg += this->GetName(); + this->GetMakefile()-> + IssueMessage(cmake::INTERNAL_ERROR, + msg.c_str()); } if(this->GetType() == cmTarget::EXECUTABLE) @@ -2424,7 +2432,11 @@ void cmTarget::GetLibraryNamesInternal(std::string& name, // enforcement of the limited imported target API. if(this->IsImported()) { - abort(); + std::string msg = "GetLibraryNamesInternal called on imported target: "; + msg += this->GetName(); + this->Makefile->IssueMessage(cmake::INTERNAL_ERROR, + msg.c_str()); + return; } // Construct the name of the soname flag variable for this language. @@ -2553,7 +2565,11 @@ void cmTarget::GetExecutableNamesInternal(std::string& name, // enforcement of the limited imported target API. if(this->IsImported()) { - abort(); + std::string msg = "GetExecutableNamesInternal called on imported target: "; + msg += this->GetName(); + this->GetMakefile()-> + IssueMessage(cmake::INTERNAL_ERROR, + msg.c_str()); } // This versioning is supported only for executables and then only @@ -2828,11 +2844,21 @@ const char* cmTarget::GetAndCreateOutputDir(bool implib, bool create) if(implib && !this->Makefile->GetDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX")) { - abort(); + std::string msg = "GetAndCreateOutputDir, imlib set but there is no " + "CMAKE_IMPORT_LIBRARY_SUFFIX for target: "; + msg += this->GetName(); + this->GetMakefile()-> + IssueMessage(cmake::INTERNAL_ERROR, + msg.c_str()); } if(implib && !this->DLLPlatform) { - abort(); + std::string msg = "implib set for platform that does not " + " support DLL's for target: "; + msg += this->GetName(); + this->GetMakefile()-> + IssueMessage(cmake::INTERNAL_ERROR, + msg.c_str()); } // Select whether we are constructing the directory for the main diff --git a/Source/cmake.h b/Source/cmake.h index cb130bcaa5..86306073ff 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -61,6 +61,7 @@ class cmake enum MessageType { AUTHOR_WARNING, FATAL_ERROR, + INTERNAL_ERROR, MESSAGE, WARNING, LOG |