1 // CMakeSetupdialog.cpp : Defines the class behaviors for the application.
5 #include "CMakeSetup.h"
6 #include "CMakeSetupDialog.h"
7 #include "CMakeCommandLineInfo.h"
8 #include "../cmDocumentation.h"
10 #include "../cmSystemTools.h"
13 //----------------------------------------------------------------------------
14 static const char * cmDocumentationName
[][3] =
17 " CMakeSetup - CMake Windows GUI.", 0},
21 //----------------------------------------------------------------------------
22 static const char * cmDocumentationUsage
[][3] =
25 " CMakeSetup [options]\n"
26 " CMakeSetup [options] <path-to-source>\n"
27 " CMakeSetup [options] <path-to-existing-build>", 0},
31 //----------------------------------------------------------------------------
32 static const char * cmDocumentationDescription
[][3] =
35 "The \"CMakeSetup\" executable is the CMake Windows GUI. Project "
36 "configuration settings may be specified interactively. "
37 "Brief instructions are provided at the bottom of the "
38 "window when the program is running.", 0},
39 CMAKE_STANDARD_INTRODUCTION
,
43 //----------------------------------------------------------------------------
44 static const char * cmDocumentationOptions
[][3] =
46 {"-A[on|off]", "Enable/disable display of advanced cache values.",
47 "There are two categories of CMake cache values: non-advanced and "
48 "advanced. Most users will not need to change the advanced options. "
49 "The CMakeSetup GUI contains a checkbox to enable/disable display of "
50 "advanced options. This command line flag changes its default setting."},
57 static char THIS_FILE
[] = __FILE__
;
60 /////////////////////////////////////////////////////////////////////////////
63 BEGIN_MESSAGE_MAP(CMakeSetup
, CWinApp
)
64 //{{AFX_MSG_MAP(CMakeSetup)
65 // NOTE - the ClassWizard will add and remove mapping macros here.
66 // DO NOT EDIT what you see in these blocks of generated code!
68 ON_COMMAND(ID_HELP
, CWinApp::OnHelp
)
72 /////////////////////////////////////////////////////////////////////////////
73 // CMakeSetup construction
74 CMakeSetup::CMakeSetup()
76 // TODO: add construction code here,
77 // Place all significant initialization in InitInstance
80 /////////////////////////////////////////////////////////////////////////////
81 // The one and only CMakeSetup object
85 /////////////////////////////////////////////////////////////////////////////
86 // CMakeSetup initialization
88 BOOL
CMakeSetup::InitInstance()
90 AfxEnableControlContainer();
92 // Standard initialization
93 // If you are not using these features and wish to reduce the size
94 // of your final executable, you should remove from the following
95 // the specific initialization routines you do not need.
98 Enable3dControls(); // Call this when using MFC in a shared DLL
100 Enable3dControlsStatic(); // Call this when linking to MFC statically
103 CMakeCommandLineInfo cmdInfo
;
104 ParseCommandLine(cmdInfo
);
105 cmSystemTools::FindExecutableDirectory(cmdInfo
.GetArgV()[0]);
107 // Check for documentation options. If there are no arguments skip
108 // the check because the GUI should be displayed instead of showing
109 // usage in this case.
111 if(cmdInfo
.GetArgC() > 1 &&
112 doc
.CheckOptions(cmdInfo
.GetArgC(), cmdInfo
.GetArgV()))
114 // Construct and print requested documentation.
117 doc
.SetCMakeRoot(hcm
.GetCacheDefinition("CMAKE_ROOT"));
118 std::vector
<cmDocumentationEntry
> commands
;
119 std::vector
<cmDocumentationEntry
> compatCommands
;
120 std::map
<std::string
,cmDocumentationSection
*> propDocs
;
122 std::vector
<cmDocumentationEntry
> generators
;
123 hcm
.GetCommandDocumentation(commands
, true, false);
124 hcm
.GetCommandDocumentation(compatCommands
, false, true);
125 hcm
.GetGeneratorDocumentation(generators
);
126 hcm
.GetPropertiesDocumentation(propDocs
);
127 doc
.SetName("cmake");
128 doc
.SetSection("Name",cmDocumentationName
);
129 doc
.SetSection("Usage",cmDocumentationUsage
);
130 doc
.SetSection("Description",cmDocumentationDescription
);
131 doc
.AppendSection("Generators",generators
);
132 doc
.PrependSection("Options",cmDocumentationOptions
);
133 doc
.SetSection("Commands",commands
);
134 doc
.SetSection("Compatilbility Commands", compatCommands
);
135 doc
.SetSections(propDocs
);
137 return (doc
.PrintRequestedDocumentation(std::cout
)? 0:1);
140 CMakeSetupDialog
dlg(cmdInfo
);
143 INT_PTR nResponse
= dlg
.DoModal();
144 if (nResponse
== IDOK
)
146 // TODO: Place code here to handle when the dialog is
149 else if (nResponse
== IDCANCEL
)
151 // TODO: Place code here to handle when the dialog is
152 // dismissed with Cancel
155 // Since the dialog has been closed, return FALSE so that we exit the
156 // application, rather than start the application's message pump.