summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmListFileCache.cxx4
-rw-r--r--Source/cmMakefile.cxx30
-rw-r--r--Source/cmMakefile.h8
-rw-r--r--Source/cmPolicies.cxx6
-rw-r--r--Source/cmake.h7
5 files changed, 25 insertions, 30 deletions
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx
index 55604a6..594f42b 100644
--- a/Source/cmListFileCache.cxx
+++ b/Source/cmListFileCache.cxx
@@ -146,7 +146,7 @@ bool cmListFile::ParseFile(const char* filename,
switch (mf->GetPolicyStatus(cmPolicies::CMP_0000))
{
case cmPolicies::WARN:
- mf->IssueWarning(
+ mf->IssueMessage(cmake::AUTHOR_WARNING,
mf->GetPolicies()->GetPolicyWarning(cmPolicies::CMP_0000)
);
@@ -155,7 +155,7 @@ bool cmListFile::ParseFile(const char* filename,
case cmPolicies::OLD:
break;
default:
- mf->IssueError(
+ mf->IssueMessage(cmake::FATAL_ERROR,
mf->GetPolicies()->GetRequiredPolicyError(cmPolicies::CMP_0000)
);
return false;
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 238e92a..f245b71 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -282,26 +282,16 @@ bool cmMakefile::CommandExists(const char* name) const
return this->GetCMakeInstance()->CommandExists(name);
}
-//----------------------------------------------------------------------------
-void cmMakefile::IssueError(std::string const& msg) const
-{
- this->IssueMessage(msg, true);
-}
//----------------------------------------------------------------------------
-void cmMakefile::IssueWarning(std::string const& msg) const
-{
- this->IssueMessage(msg, false);
-}
-
-//----------------------------------------------------------------------------
-void cmMakefile::IssueMessage(std::string const& text, bool isError) const
+void cmMakefile::IssueMessage(cmake::MessageType t, std::string const& text) const
{
cmOStringStream msg;
-
+ bool isError = false;
// Construct the message header.
- if(isError)
+ if(t == cmake::FATAL_ERROR)
{
+ isError = true;
msg << "CMake Error:";
}
else
@@ -439,7 +429,7 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff,
if(!status.GetNestedError())
{
// The command invocation requested that we report an error.
- this->IssueError(pcmd->GetError());
+ this->IssueMessage(cmake::FATAL_ERROR, pcmd->GetError());
}
result = false;
if ( this->GetCMakeInstance()->GetScriptMode() )
@@ -459,7 +449,7 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff,
std::string error = "Command ";
error += pcmd->GetName();
error += "() is not scriptable";
- this->IssueError(error);
+ this->IssueMessage(cmake::FATAL_ERROR, error);
result = false;
cmSystemTools::SetFatalErrorOccured();
}
@@ -471,7 +461,7 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff,
std::string error = "Unknown CMake command \"";
error += lff.Name;
error += "\".";
- this->IssueError(error);
+ this->IssueMessage(cmake::FATAL_ERROR, error);
result = false;
cmSystemTools::SetFatalErrorOccured();
}
@@ -619,7 +609,7 @@ bool cmMakefile::ReadListFile(const char* filename_in,
{
if(endScopeNicely)
{
- this->IssueError("cmake_policy PUSH without matching POP");
+ this->IssueMessage(cmake::FATAL_ERROR, "cmake_policy PUSH without matching POP");
}
this->PopPolicy(false);
}
@@ -3260,13 +3250,13 @@ bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg,
switch (this->GetPolicyStatus(cmPolicies::CMP_0002))
{
case cmPolicies::WARN:
- this->IssueWarning(this->GetPolicies()->
+ this->IssueMessage(cmake::AUTHOR_WARNING, this->GetPolicies()->
GetPolicyWarning(cmPolicies::CMP_0002));
case cmPolicies::OLD:
return true;
case cmPolicies::REQUIRED_IF_USED:
case cmPolicies::REQUIRED_ALWAYS:
- this->IssueError(
+ this->IssueMessage(cmake::FATAL_ERROR,
this->GetPolicies()->GetRequiredPolicyError(cmPolicies::CMP_0002)
);
return true;
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index b679ff4..33309e1 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -25,6 +25,7 @@
#include "cmPropertyMap.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
+#include "cmake.h"
#if defined(CMAKE_BUILD_WITH_CMAKE)
#include "cmSourceGroup.h"
@@ -784,9 +785,8 @@ public:
void PopScope();
void RaiseScope(const char *var, const char *value);
- /** Issue messages with the given text plus context information. */
- void IssueWarning(std::string const& msg) const;
- void IssueError(std::string const& msg) const;
+ void IssueMessage(cmake::MessageType t,
+ std::string const& text) const;
protected:
// add link libraries and directories to the target
@@ -891,8 +891,6 @@ private:
CallStackType CallStack;
friend class cmMakefileCall;
- void IssueMessage(std::string const& text, bool isError) const;
-
cmTarget* FindBasicTarget(const char* name);
std::vector<cmTarget*> ImportedTargetsOwned;
std::map<cmStdString, cmTarget*> ImportedTargets;
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index 647d6d4..cdb39e0 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -202,8 +202,8 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf,
// it is an error if the policy version is less than 2.4
if (majorVer < 2 || majorVer == 2 && minorVer < 4)
- {
- mf->IssueError(
+ {
+ mf->IssueMessage(cmake::FATAL_ERROR,
"An attempt was made to set the policy version of CMake to something "
"earlier than \"2.4\". "
"In CMake 2.4 and below backwards compatibility was handled with the "
@@ -213,7 +213,7 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf,
"CMAKE_BACKWARDS_COMPATIBILITY variable. "
"One way to so this is to set the policy version to 2.4 exactly."
);
- }
+ }
// now loop over all the policies and set them as appropriate
std::map<cmPolicies::PolicyID,cmPolicy *>::iterator i
diff --git a/Source/cmake.h b/Source/cmake.h
index c7ed21c..b8ca27f 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -58,6 +58,13 @@ class cmPolicies;
class cmake
{
public:
+ enum MessageType
+ { AUTHOR_WARNING,
+ FATAL_ERROR,
+ MESSAGE,
+ WARNING,
+ LOG
+ };
typedef std::map<cmStdString, cmCommand*> RegisteredCommandsMap;
///! construct an instance of cmake