cmakemain.cxx 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 "cmakewizard.h"
  14. #include "cmake.h"
  15. #include "cmCacheManager.h"
  16. #include "cmDynamicLoader.h"
  17. #include "cmListFileCache.h"
  18. int do_cmake(int ac, char** av);
  19. int main(int ac, char** av)
  20. {
  21. int ret = do_cmake(ac, av);
  22. #ifdef CMAKE_BUILD_WITH_CMAKE
  23. cmDynamicLoader::FlushCache();
  24. #endif
  25. cmListFileCache::GetInstance()->ClearCache();
  26. return ret;
  27. }
  28. int do_cmake(int ac, char** av)
  29. {
  30. bool wiz = false;
  31. bool command = false;
  32. std::vector<std::string> args;
  33. for(int i =0; i < ac; ++i)
  34. {
  35. if(strcmp(av[i], "-i") == 0)
  36. {
  37. wiz = true;
  38. }
  39. else
  40. {
  41. if (strcmp(av[i], "-E") == 0)
  42. {
  43. command = true;
  44. }
  45. else
  46. {
  47. args.push_back(av[i]);
  48. }
  49. }
  50. }
  51. if(command)
  52. {
  53. int ret = cmake::CMakeCommand(args);
  54. return ret;
  55. }
  56. if (wiz)
  57. {
  58. cmakewizard wizard;
  59. wizard.RunWizard(args);
  60. return 0;
  61. }
  62. cmake cm;
  63. return cm.Run(args);
  64. }