1 // CMakeGenDialog.cpp : implementation file
5 #include "CMakeSetup.h"
6 #include "CMakeGenDialog.h"
12 static char THIS_FILE
[] = __FILE__
;
15 /////////////////////////////////////////////////////////////////////////////
16 // CCMakeGenDialog dialog
19 CCMakeGenDialog::CCMakeGenDialog(CWnd
* pParent
/*=NULL*/)
20 : CDialog(CCMakeGenDialog::IDD
, pParent
)
22 //{{AFX_DATA_INIT(CCMakeGenDialog)
27 void CCMakeGenDialog::DoDataExchange(CDataExchange
* pDX
)
29 CDialog::DoDataExchange(pDX
);
30 //{{AFX_DATA_MAP(CCMakeGenDialog)
31 DDX_Control(pDX
, IDC_BuildForLabel
, m_BuildForLabel
);
32 DDX_Control(pDX
, IDC_Generator
, m_GeneratorChoice
);
33 DDX_CBStringExact(pDX
, IDC_Generator
, m_GeneratorChoiceString
);
38 BEGIN_MESSAGE_MAP(CCMakeGenDialog
, CDialog
)
39 //{{AFX_MSG_MAP(CCMakeGenDialog)
40 // NOTE: the ClassWizard will add message map macros here
41 ON_CBN_EDITCHANGE(IDC_Generator
, OnEditchangeGenerator
)
45 /////////////////////////////////////////////////////////////////////////////
46 // CCMakeGenDialog message handler
48 void CCMakeGenDialog::OnEditchangeGenerator()
50 // TODO: Add your control notification handler code here
55 BOOL
CCMakeGenDialog::OnInitDialog()
57 CDialog::OnInitDialog();
58 std::vector
<std::string
> names
;
59 this->m_CMakeInstance
->GetRegisteredGenerators(names
);
60 for(std::vector
<std::string
>::iterator i
= names
.begin();
61 i
!= names
.end(); ++i
)
63 m_GeneratorChoice
.AddString(i
->c_str());
66 // we want to pick the best generator for their system first we check to
67 // see if they have run cmake before, if so we use that generator
71 // is the last generator set? If so use it
72 mp
= "[HKEY_CURRENT_USER\\Software\\Kitware"
73 "\\CMakeSetup\\Settings\\StartPath;LastGenerator]";
74 cmSystemTools::ExpandRegistryValues(mp
);
77 m_GeneratorChoiceString
= mp
.c_str();
83 const char* GeneratorName
;
85 regToGen installedGenerators
[] = {
87 { "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft"
88 "\\VisualStudio\\9.0\\Setup;Dbghelp_path]", "Visual Studio 9 2008"},
90 { "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft"
91 "\\VisualStudio\\8.0\\Setup;Dbghelp_path]", "Visual Studio 8 2005"},
93 {"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft"
94 "\\VisualStudio\\7.1;InstallDir]", "Visual Studio 7 .NET 2003"},
96 {"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft"
97 "\\VisualStudio\\7.0;InstallDir]", "Visual Studio 7"},
100 for(regToGen
* ptr
= installedGenerators
; ptr
->Registry
!= 0 && !done
; ptr
++)
103 cmSystemTools::ExpandRegistryValues(mp
);
104 if(mp
!= "/registry")
106 m_GeneratorChoiceString
= ptr
->GeneratorName
;
111 // if still not done just guess on VS 6
114 m_GeneratorChoiceString
= "Visual Studio 6";
117 this->UpdateData(FALSE
);
119 return TRUE
; // return TRUE unless you set the focus to a control