cmw9xcom.cxx 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. #include "cmSystemTools.h"
  11. #include "cmWin32ProcessExecution.h"
  12. // this is a test driver program for cmake.
  13. int main (int argc, char *argv[])
  14. {
  15. cmSystemTools::EnableMSVCDebugHook();
  16. if ( argc <= 1 )
  17. {
  18. std::cerr << "Usage: " << argv[0] << " executable" << std::endl;
  19. return 1;
  20. }
  21. std::string arg = argv[1];
  22. if ( (arg.find_first_of(" ") != arg.npos) &&
  23. (arg.find_first_of("\"") == arg.npos) )
  24. {
  25. arg = "\"" + arg + "\"";
  26. }
  27. std::string command = arg;
  28. int cc;
  29. for ( cc = 2; cc < argc; cc ++ )
  30. {
  31. std::string nextArg = argv[cc];
  32. if ( (nextArg.find_first_of(" ") != nextArg.npos) &&
  33. (nextArg.find_first_of("\"") == nextArg.npos) )
  34. {
  35. nextArg = "\"" + nextArg + "\"";
  36. }
  37. command += " ";
  38. command += nextArg;
  39. }
  40. return cmWin32ProcessExecution::Windows9xHack(command.c_str());
  41. }