summaryrefslogtreecommitdiffstats
path: root/Source/cmCallVisualStudioMacro.cxx
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2008-07-30 19:26:34 (GMT)
committerDavid Cole <david.cole@kitware.com>2008-07-30 19:26:34 (GMT)
commit17452105cd4a2d5cb22591171e462559c6127507 (patch)
treef39d9eb8c3bcb7cf719bc639247d2637cdb328a7 /Source/cmCallVisualStudioMacro.cxx
parentbeeebcdc407eda8d29ff342f1570af4740e600ee (diff)
downloadCMake-17452105cd4a2d5cb22591171e462559c6127507.zip
CMake-17452105cd4a2d5cb22591171e462559c6127507.tar.gz
CMake-17452105cd4a2d5cb22591171e462559c6127507.tar.bz2
BUG: Fix issue #7088 - do not emit error messages when attempts to run Visual Studio macros fail. You can still get the error output as messages if you want using --debug-output from the cmake command line.
Diffstat (limited to 'Source/cmCallVisualStudioMacro.cxx')
-rw-r--r--Source/cmCallVisualStudioMacro.cxx42
1 files changed, 29 insertions, 13 deletions
diff --git a/Source/cmCallVisualStudioMacro.cxx b/Source/cmCallVisualStudioMacro.cxx
index 2476631..2aefd20 100644
--- a/Source/cmCallVisualStudioMacro.cxx
+++ b/Source/cmCallVisualStudioMacro.cxx
@@ -24,6 +24,11 @@
#endif
+// Just for this file:
+//
+static bool LogErrorsAsMessages;
+
+
#if defined(HAVE_COMDEF_H)
@@ -31,17 +36,20 @@
//----------------------------------------------------------------------------
-///! Use ReportHRESULT to make a cmSystemTools::Error after calling
+///! Use ReportHRESULT to make a cmSystemTools::Message after calling
///! a COM method that may have failed.
#define ReportHRESULT(hr, context) \
if (FAILED(hr)) \
{ \
- std::ostringstream oss; \
- oss.flags(std::ios::hex); \
- oss << context << " failed HRESULT, hr = 0x" << hr << std::endl; \
- oss.flags(std::ios::dec); \
- oss << __FILE__ << "(" << __LINE__ << ")"; \
- cmSystemTools::Error(oss.str().c_str()); \
+ if (LogErrorsAsMessages) \
+ { \
+ std::ostringstream oss; \
+ oss.flags(std::ios::hex); \
+ oss << context << " failed HRESULT, hr = 0x" << hr << std::endl; \
+ oss.flags(std::ios::dec); \
+ oss << __FILE__ << "(" << __LINE__ << ")"; \
+ cmSystemTools::Message(oss.str().c_str()); \
+ } \
}
@@ -404,6 +412,8 @@ int cmCallVisualStudioMacro::GetNumberOfRunningVisualStudioInstances(
{
int count = 0;
+ LogErrorsAsMessages = false;
+
#if defined(HAVE_COMDEF_H)
HRESULT hr = CoInitialize(0);
ReportHRESULT(hr, "CoInitialize");
@@ -438,10 +448,13 @@ int cmCallVisualStudioMacro::GetNumberOfRunningVisualStudioInstances(
int cmCallVisualStudioMacro::CallMacro(
const std::string& slnFile,
const std::string& macro,
- const std::string& args)
+ const std::string& args,
+ const bool logErrorsAsMessages)
{
int err = 1; // no comdef.h
+ LogErrorsAsMessages = logErrorsAsMessages;
+
#if defined(HAVE_COMDEF_H)
err = 2; // error initializing
@@ -489,16 +502,19 @@ int cmCallVisualStudioMacro::CallMacro(
(void)slnFile;
(void)macro;
(void)args;
- cmSystemTools::Error("cmCallVisualStudioMacro::CallMacro is not "
- "supported on this platform");
+ if (LogErrorsAsMessages)
+ {
+ cmSystemTools::Message("cmCallVisualStudioMacro::CallMacro is not "
+ "supported on this platform");
+ }
#endif
- if (err)
+ if (err && LogErrorsAsMessages)
{
std::ostringstream oss;
oss << "cmCallVisualStudioMacro::CallMacro failed, err = " << err;
- cmSystemTools::Error(oss.str().c_str());
+ cmSystemTools::Message(oss.str().c_str());
}
- return err;
+ return 0;
}