summaryrefslogtreecommitdiffstats
path: root/Source/cmCreateTestSourceList.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2002-12-11 19:15:35 (GMT)
committerBrad King <brad.king@kitware.com>2002-12-11 19:15:35 (GMT)
commit3bcbca96ab7424852e1cc4e15ef19174e40db224 (patch)
treed928862a6adb8a861348895c5ca73c8e94d28aec /Source/cmCreateTestSourceList.cxx
parent682e2c7b8b614b595dcff32ffe24d67a5e26ff54 (diff)
downloadCMake-3bcbca96ab7424852e1cc4e15ef19174e40db224.zip
CMake-3bcbca96ab7424852e1cc4e15ef19174e40db224.tar.gz
CMake-3bcbca96ab7424852e1cc4e15ef19174e40db224.tar.bz2
ENH: Improved implementation of MSVC debug hook to only add the hook if DART_TEST_FROM_DART is set in the environment. This is better than always adding the hook and testing the environment from the callback.
Diffstat (limited to 'Source/cmCreateTestSourceList.cxx')
-rw-r--r--Source/cmCreateTestSourceList.cxx17
1 files changed, 9 insertions, 8 deletions
diff --git a/Source/cmCreateTestSourceList.cxx b/Source/cmCreateTestSourceList.cxx
index 62286bc..5ed0f44 100644
--- a/Source/cmCreateTestSourceList.cxx
+++ b/Source/cmCreateTestSourceList.cxx
@@ -96,7 +96,8 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& argsIn)
"#include <ctype.h>\n"
"#include <stdio.h>\n"
"#include <string.h>\n"
- "#include <stdlib.h>\n";
+ "#include <stdlib.h>\n"
+ "\n";
fout <<
"#if defined(_MSC_VER) && defined(_DEBUG)\n"
"/* MSVC debug hook to prevent dialogs when running from DART. */\n"
@@ -104,11 +105,8 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& argsIn)
"static int TestDriverDebugReport(int type, char* message, int* retVal)\n"
"{\n"
" (void)type; (void)retVal;\n"
- " if(getenv(\"DART_TEST_FROM_DART\"))\n"
- " {\n"
- " fprintf(stderr, message);\n"
- " exit(1);\n"
- " }\n"
+ " fprintf(stderr, message);\n"
+ " exit(1);\n"
" return 0;\n"
"}\n"
"#endif\n";
@@ -221,8 +219,11 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& argsIn)
" char *arg, *test_name;\n"
" \n"
"#if defined(_MSC_VER) && defined(_DEBUG)\n"
- " /* Put in hook for debug library. */\n"
- " _CrtSetReportHook(TestDriverDebugReport);\n"
+ " /* If running from DART, put in debug hook. */\n"
+ " if(getenv(\"DART_TEST_FROM_DART\"))\n"
+ " {\n"
+ " _CrtSetReportHook(TestDriverDebugReport);\n"
+ " }\n"
"#endif\n"
" \n"
" NumTests = " << numTests << ";\n"