cmMSProjectGenerator.cxx 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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 "cmMSProjectGenerator.h"
  14. #include "cmDSWWriter.h"
  15. #include "cmDSPWriter.h"
  16. #include "cmCacheManager.h"
  17. cmMSProjectGenerator::cmMSProjectGenerator()
  18. {
  19. m_DSWWriter = 0;
  20. m_DSPWriter = 0;
  21. BuildDSWOn();
  22. }
  23. void cmMSProjectGenerator::GenerateMakefile()
  24. {
  25. this->EnableLanguage("CXX");
  26. if(m_BuildDSW)
  27. {
  28. delete m_DSWWriter;
  29. m_DSWWriter = 0;
  30. m_DSWWriter = new cmDSWWriter(m_Makefile);
  31. m_DSWWriter->OutputDSWFile();
  32. }
  33. else
  34. {
  35. delete m_DSPWriter;
  36. m_DSPWriter = 0;
  37. m_DSPWriter = new cmDSPWriter(m_Makefile);
  38. m_DSPWriter->OutputDSPFile();
  39. }
  40. }
  41. cmMSProjectGenerator::~cmMSProjectGenerator()
  42. {
  43. delete m_DSPWriter;
  44. delete m_DSWWriter;
  45. }
  46. void cmMSProjectGenerator::SetLocal(bool local)
  47. {
  48. m_BuildDSW = !local;
  49. }
  50. void cmMSProjectGenerator::EnableLanguage(const char*)
  51. {
  52. // now load the settings
  53. if(!m_Makefile->GetDefinition("CMAKE_ROOT"))
  54. {
  55. cmSystemTools::Error(
  56. "CMAKE_ROOT has not been defined, bad GUI or driver program");
  57. return;
  58. }
  59. if(!this->GetLanguageEnabled("CXX"))
  60. {
  61. std::string fpath =
  62. m_Makefile->GetDefinition("CMAKE_ROOT");
  63. fpath += "/Templates/CMakeWindowsSystemConfig.cmake";
  64. m_Makefile->ReadListFile(NULL,fpath.c_str());
  65. this->SetLanguageEnabled("CXX");
  66. }
  67. }