cmw9xcom.cxx 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*=========================================================================
  2. Program: CMake - Cross-Platform Makefile Generator
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  8. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
  9. This software is distributed WITHOUT ANY WARRANTY; without even
  10. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. PURPOSE. See the above copyright notices for more information.
  12. =========================================================================*/
  13. #include "cmSystemTools.h"
  14. #include "cmWin32ProcessExecution.h"
  15. // this is a test driver program for cmake.
  16. int main (int argc, char *argv[])
  17. {
  18. cmSystemTools::EnableMSVCDebugHook();
  19. if ( argc <= 1 )
  20. {
  21. std::cerr << "Usage: " << argv[0] << " executable" << std::endl;
  22. return 1;
  23. }
  24. std::string arg = argv[1];
  25. if ( (arg.find_first_of(" ") != arg.npos) &&
  26. (arg.find_first_of("\"") == arg.npos) )
  27. {
  28. arg = "\"" + arg + "\"";
  29. }
  30. std::string command = arg;
  31. int cc;
  32. for ( cc = 2; cc < argc; cc ++ )
  33. {
  34. std::string arg = argv[cc];
  35. if ( (arg.find_first_of(" ") != arg.npos) &&
  36. (arg.find_first_of("\"") == arg.npos) )
  37. {
  38. arg = "\"" + arg + "\"";
  39. }
  40. command += " ";
  41. command += arg;
  42. }
  43. return cmWin32ProcessExecution::Windows9xHack(command.c_str());
  44. }