Browse Source

ENH: Added cmSystemTools::EnableMSVCDebugHook() to prevent error dialogs when CMake is invoked by Dart.

pull/1/head
Brad King 23 years ago
parent
commit
d6f98c2a82
  1. 1
      Source/cmDumpDocumentation.cxx
  2. 23
      Source/cmSystemTools.cxx
  3. 6
      Source/cmSystemTools.h
  4. 1
      Source/cmakemain.cxx
  5. 1
      Source/cmaketest.cxx
  6. 1
      Source/cmw9xcom.cxx
  7. 1
      Source/ctest.cxx

1
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)

23
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

6
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
/**

1
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();

1
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();

1
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;

1
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

Loading…
Cancel
Save