summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2002-12-11 16:49:08 (GMT)
committerBrad King <brad.king@kitware.com>2002-12-11 16:49:08 (GMT)
commitd6f98c2a82c693f9f96bd7c515fa4946a375f3ca (patch)
tree8d5ef7199c1196cbc32e673a4b668b98561f943a
parente9e3855c65e9ee32119645d6e4044ba0ee8b8a06 (diff)
downloadCMake-d6f98c2a82c693f9f96bd7c515fa4946a375f3ca.zip
CMake-d6f98c2a82c693f9f96bd7c515fa4946a375f3ca.tar.gz
CMake-d6f98c2a82c693f9f96bd7c515fa4946a375f3ca.tar.bz2
ENH: Added cmSystemTools::EnableMSVCDebugHook() to prevent error dialogs when CMake is invoked by Dart.
-rw-r--r--Source/cmDumpDocumentation.cxx1
-rw-r--r--Source/cmSystemTools.cxx23
-rw-r--r--Source/cmSystemTools.h6
-rw-r--r--Source/cmakemain.cxx1
-rw-r--r--Source/cmaketest.cxx1
-rw-r--r--Source/cmw9xcom.cxx1
-rw-r--r--Source/ctest.cxx1
7 files changed, 34 insertions, 0 deletions
diff --git a/Source/cmDumpDocumentation.cxx b/Source/cmDumpDocumentation.cxx
index e920f96..18473b8 100644
--- a/Source/cmDumpDocumentation.cxx
+++ b/Source/cmDumpDocumentation.cxx
@@ -21,6 +21,7 @@
int main(int ac, char** av)
{
+ cmSystemTools::EnableMSVCDebugHook();
cmake cmi;
const char* outname = "cmake.html";
if(ac > 1)
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 40fafe2..7750349 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -2427,3 +2427,26 @@ void cmSystemTools::SplitProgramFromArgs(const char* path,
program = "";
args = "";
}
+
+#if defined(_MSC_VER) && defined(_DEBUG)
+# include <crtdbg.h>
+# include <stdio.h>
+# include <stdlib.h>
+static int cmSystemToolsDebugReport(int, char* message, int*)
+{
+ if(getenv("DART_TEST_FROM_DART"))
+ {
+ fprintf(stderr, message);
+ exit(1);
+ }
+ return 0;
+}
+void cmSystemTools::EnableMSVCDebugHook()
+{
+ _CrtSetReportHook(cmSystemToolsDebugReport);
+}
+#else
+void cmSystemTools::EnableMSVCDebugHook()
+{
+}
+#endif
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index 190ebdb..0e41691 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -356,6 +356,12 @@ public:
*/
static void SetRunCommandHideConsole(bool v){s_RunCommandHideConsole = v;}
static bool GetRunCommandHideConsole(){ return s_RunCommandHideConsole;}
+
+ /** When building DEBUG with MSVC, this enables a hook that prevents
+ * error dialogs from popping up if the program is being run from
+ * DART.
+ */
+ static void EnableMSVCDebugHook();
protected:
// these two functions can be called from ConvertToOutputPath
/**
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index 2781f0b..96112bc 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -25,6 +25,7 @@ void updateProgress(const char *msg, float prog, void *cd);
int main(int ac, char** av)
{
+ cmSystemTools::EnableMSVCDebugHook();
int ret = do_cmake(ac, av);
#ifdef CMAKE_BUILD_WITH_CMAKE
cmDynamicLoader::FlushCache();
diff --git a/Source/cmaketest.cxx b/Source/cmaketest.cxx
index e3c4039..efb312e 100644
--- a/Source/cmaketest.cxx
+++ b/Source/cmaketest.cxx
@@ -29,6 +29,7 @@ int do_cmaketest(int ac, char** av);
int main(int ac, char** av)
{
+ cmSystemTools::EnableMSVCDebugHook();
int ret = do_cmaketest(ac, av);
#ifdef CMAKE_BUILD_WITH_CMAKE
cmDynamicLoader::FlushCache();
diff --git a/Source/cmw9xcom.cxx b/Source/cmw9xcom.cxx
index 33f474b..cb41719 100644
--- a/Source/cmw9xcom.cxx
+++ b/Source/cmw9xcom.cxx
@@ -20,6 +20,7 @@
// this is a test driver program for cmake.
int main (int argc, char *argv[])
{
+ cmSystemTools::EnableMSVCDebugHook();
if ( argc <= 1 )
{
std::cerr << "Usage: " << argv[0] << " executable" << std::endl;
diff --git a/Source/ctest.cxx b/Source/ctest.cxx
index 3dd6fd8..4fba9b1 100644
--- a/Source/ctest.cxx
+++ b/Source/ctest.cxx
@@ -1422,6 +1422,7 @@ int ctest::ProcessTests()
// this is a test driver program for cmake.
int main (int argc, char *argv[])
{
+ cmSystemTools::EnableMSVCDebugHook();
ctest inst;
// look at the args