cmakemain.cxx 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*=========================================================================
  2. Program: Insight Segmentation & Registration Toolkit
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Insight Consortium. All rights reserved.
  8. See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm 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 "cmakewizard.h"
  14. #include "cmake.h"
  15. #include "cmMakefileGenerator.h"
  16. #include "cmCacheManager.h"
  17. int main(int ac, char** av)
  18. {
  19. bool wiz = false;
  20. bool command = false;
  21. std::vector<std::string> args;
  22. for(int i =0; i < ac; ++i)
  23. {
  24. if(strcmp(av[i], "-i") == 0)
  25. {
  26. wiz = true;
  27. }
  28. else
  29. {
  30. if (strcmp(av[i], "-E") == 0)
  31. {
  32. command = true;
  33. }
  34. else
  35. {
  36. args.push_back(av[i]);
  37. }
  38. }
  39. }
  40. if(command)
  41. {
  42. int ret = cmake::CMakeCommand(args);
  43. return ret;
  44. }
  45. if (wiz)
  46. {
  47. cmakewizard wizard;
  48. wizard.RunWizard(args);
  49. cmMakefileGenerator::UnRegisterGenerators();
  50. cmCacheManager::DeleteInstance();
  51. return 0;
  52. }
  53. cmake cm;
  54. int ret = cm.Generate(args);
  55. cmMakefileGenerator::UnRegisterGenerators();
  56. cmCacheManager::DeleteInstance();
  57. return ret;
  58. }