diff options
author | Ken Martin <ken.martin@kitware.com> | 2001-06-27 13:17:12 (GMT) |
---|---|---|
committer | Ken Martin <ken.martin@kitware.com> | 2001-06-27 13:17:12 (GMT) |
commit | c19c252e23ece64d0533e450668d26c976251ce2 (patch) | |
tree | f812a7cec06732ad4579d657438e6f854bf5d41b /Source | |
parent | c6418bd34b5c66f636bb2aadb3b5af7a22e81227 (diff) | |
download | CMake-c19c252e23ece64d0533e450668d26c976251ce2.zip CMake-c19c252e23ece64d0533e450668d26c976251ce2.tar.gz CMake-c19c252e23ece64d0533e450668d26c976251ce2.tar.bz2 |
minor fixes to testing
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmSystemTools.cxx | 3 | ||||
-rw-r--r-- | Source/cmaketest.cxx | 42 | ||||
-rw-r--r-- | Source/cmaketest.h.in | 2 |
3 files changed, 40 insertions, 7 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 556bacc..a3221c0 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -780,7 +780,8 @@ bool cmSystemTools::RunCommand(const char* command, std::ifstream fin(tempFile.c_str()); if(!fin) { - cmSystemTools::Error(command, " from RunCommand Faild to create output file", + cmSystemTools::Error(command, + " from RunCommand Failed to create output file: ", tempFile.c_str()); return false; } diff --git a/Source/cmaketest.cxx b/Source/cmaketest.cxx index 050655d..8838e68 100644 --- a/Source/cmaketest.cxx +++ b/Source/cmaketest.cxx @@ -37,19 +37,51 @@ main (int argc, char *argv[]) } // now build the test - if (!cmSystemTools::RunCommand(MAKECOMMAND, output)) + std::string makeCommand = MAKEPROGRAM; + makeCommand += " "; + makeCommand += argv[3]; +#ifdef _WIN32 + makeCommand += ".dsw /MAKE \"ALL_BUILD - Release\" /REBUILD"; +#endif + if (!cmSystemTools::RunCommand(makeCommand.c_str(), output)) { - std::cerr << "Error: " MAKECOMMAND " execution failed\n"; + std::cerr << "Error: " << makeCommand.c_str() << " execution failed\n"; std::cerr << output.c_str() << "\n"; // return to the original directory cmSystemTools::ChangeDirectory(cwd.c_str()); return 1; } - // now run the compiled test - if (!cmSystemTools::RunCommand(argv[3], output)) + // now run the compiled test if we can find it + // See if the executable exists as written. + std::string fullPath; + if(cmSystemTools::FileExists(argv[3])) { - std::cerr << "Error: " << argv[3] << " execution failed\n"; + fullPath = cmSystemTools::CollapseFullPath(argv[3]); + } + std::string tryPath = argv[3]; + tryPath += cmSystemTools::GetExecutableExtension(); + if(cmSystemTools::FileExists(tryPath.c_str())) + { + fullPath = cmSystemTools::CollapseFullPath(tryPath.c_str()); + } + + // try the release extension + tryPath = "Release/"; + tryPath += cmSystemTools::GetFilenameName(argv[3]); + if(cmSystemTools::FileExists(tryPath.c_str())) + { + fullPath = cmSystemTools::CollapseFullPath(tryPath.c_str()); + } + tryPath += cmSystemTools::GetExecutableExtension(); + if(cmSystemTools::FileExists(tryPath.c_str())) + { + fullPath = cmSystemTools::CollapseFullPath(tryPath.c_str()); + } + + if (!cmSystemTools::RunCommand(fullPath.c_str(), output)) + { + std::cerr << "Error: " << fullPath.c_str() << " execution failed\n"; // return to the original directory cmSystemTools::ChangeDirectory(cwd.c_str()); return 1; diff --git a/Source/cmaketest.h.in b/Source/cmaketest.h.in index 74f1ec7..6178036 100644 --- a/Source/cmaketest.h.in +++ b/Source/cmaketest.h.in @@ -1,3 +1,3 @@ #define CMAKE_COMMAND "${CMAKE_COMMAND}" -#define MAKECOMMAND "${MAKECOMMAND}" +#define MAKEPROGRAM "${MAKEPROGRAM}" |