1
0

CMakeSetup.cpp 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. // CMakeSetupdialog.cpp : Defines the class behaviors for the application.
  2. //
  3. #include "stdafx.h"
  4. #include "CMakeSetup.h"
  5. #include "CMakeSetupDialog.h"
  6. #include "CMakeCommandLineInfo.h"
  7. #include "../cmDocumentation.h"
  8. #include "../cmake.h"
  9. //----------------------------------------------------------------------------
  10. static const cmDocumentationEntry cmDocumentationName[] =
  11. {
  12. {0,
  13. " CMakeSetup - CMake Windows GUI.", 0},
  14. {0,0,0}
  15. };
  16. //----------------------------------------------------------------------------
  17. static const cmDocumentationEntry cmDocumentationUsage[] =
  18. {
  19. {0,
  20. " CMakeSetup [options]\n"
  21. " CMakeSetup [options] <path-to-source>\n"
  22. " CMakeSetup [options] <path-to-build>", 0},
  23. {0,0,0}
  24. };
  25. //----------------------------------------------------------------------------
  26. static const cmDocumentationEntry cmDocumentationDescription[] =
  27. {
  28. {0,
  29. "The \"CMakeSetup\" executable is the CMake Windows GUI. Project "
  30. "configuration settings may be specified interactively. "
  31. "Brief instructions are provided at the bottom of the "
  32. "window when the program is running.", 0},
  33. CMAKE_STANDARD_INTRODUCTION,
  34. {0,0,0}
  35. };
  36. //----------------------------------------------------------------------------
  37. static const cmDocumentationEntry cmDocumentationOptions[] =
  38. {
  39. {"-A[on|off]", "Enable/disable display of advanced cache values.",
  40. "There are two categories of CMake cache values: non-advanced and "
  41. "advanced. Most users will not need to change the advanced options. "
  42. "The CMakeSetup GUI contains a checkbox to enable/disable display of "
  43. "advanced options. This command line flag changes its default setting."},
  44. {0,0,0}
  45. };
  46. #ifdef _DEBUG
  47. #define new DEBUG_NEW
  48. #undef THIS_FILE
  49. static char THIS_FILE[] = __FILE__;
  50. #endif
  51. /////////////////////////////////////////////////////////////////////////////
  52. // CMakeSetup
  53. BEGIN_MESSAGE_MAP(CMakeSetup, CWinApp)
  54. //{{AFX_MSG_MAP(CMakeSetup)
  55. // NOTE - the ClassWizard will add and remove mapping macros here.
  56. // DO NOT EDIT what you see in these blocks of generated code!
  57. //}}AFX_MSG
  58. ON_COMMAND(ID_HELP, CWinApp::OnHelp)
  59. END_MESSAGE_MAP();
  60. /////////////////////////////////////////////////////////////////////////////
  61. // CMakeSetup construction
  62. CMakeSetup::CMakeSetup()
  63. {
  64. // TODO: add construction code here,
  65. // Place all significant initialization in InitInstance
  66. }
  67. /////////////////////////////////////////////////////////////////////////////
  68. // The one and only CMakeSetup object
  69. CMakeSetup theApp;
  70. /////////////////////////////////////////////////////////////////////////////
  71. // CMakeSetup initialization
  72. BOOL CMakeSetup::InitInstance()
  73. {
  74. AfxEnableControlContainer();
  75. // Standard initialization
  76. // If you are not using these features and wish to reduce the size
  77. // of your final executable, you should remove from the following
  78. // the specific initialization routines you do not need.
  79. #if _MFC_VER <= 0x421
  80. #ifdef _AFXDLL
  81. Enable3dControls(); // Call this when using MFC in a shared DLL
  82. #else
  83. Enable3dControlsStatic(); // Call this when linking to MFC statically
  84. #endif
  85. #endif
  86. CMakeCommandLineInfo cmdInfo;
  87. ParseCommandLine(cmdInfo);
  88. // Check for documentation options.
  89. cmDocumentation doc;
  90. if(doc.CheckOptions(cmdInfo.GetArgC(), cmdInfo.GetArgV()))
  91. {
  92. // Construct and print requested documentation.
  93. cmake hcm;
  94. std::vector<cmDocumentationEntry> commands;
  95. std::vector<cmDocumentationEntry> generators;
  96. hcm.GetCommandDocumentation(commands);
  97. hcm.GetGeneratorDocumentation(generators);
  98. doc.SetNameSection(cmDocumentationName);
  99. doc.SetUsageSection(cmDocumentationUsage);
  100. doc.SetDescriptionSection(cmDocumentationDescription);
  101. doc.SetGeneratorsSection(&generators[0]);
  102. doc.SetOptionsSection(cmDocumentationOptions);
  103. doc.SetCommandsSection(&commands[0]);
  104. return (doc.PrintRequestedDocumentation(std::cout)? 0:1);
  105. }
  106. CMakeSetupDialog dlg(cmdInfo);
  107. m_pMainWnd = &dlg;
  108. INT_PTR nResponse = dlg.DoModal();
  109. if (nResponse == IDOK)
  110. {
  111. // TODO: Place code here to handle when the dialog is
  112. // dismissed with OK
  113. }
  114. else if (nResponse == IDCANCEL)
  115. {
  116. // TODO: Place code here to handle when the dialog is
  117. // dismissed with Cancel
  118. }
  119. // Since the dialog has been closed, return FALSE so that we exit the
  120. // application, rather than start the application's message pump.
  121. return FALSE;
  122. }