ENH: Added cmSystemTools::EnableMSVCDebugHook() to prevent error dialogs when CMake is invoked by Dart.
This commit is contained in:
parent
e9e3855c65
commit
d6f98c2a82
|
@ -21,6 +21,7 @@
|
|||
|
||||
int main(int ac, char** av)
|
||||
{
|
||||
cmSystemTools::EnableMSVCDebugHook();
|
||||
cmake cmi;
|
||||
const char* outname = "cmake.html";
|
||||
if(ac > 1)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
/**
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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…
Reference in New Issue