CMakeSetupDialog.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613
  1. // pcbuilderdialogDlg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "CMakeSetup.h"
  5. #include "CMakeSetupDialog.h"
  6. #include "../cmDSWMakefile.h"
  7. #include "../cmMSProjectGenerator.h"
  8. #include "../cmCacheManager.h"
  9. #include "../cmMakefile.h"
  10. #ifdef _DEBUG
  11. #define new DEBUG_NEW
  12. #undef THIS_FILE
  13. static char THIS_FILE[] = __FILE__;
  14. #endif
  15. /////////////////////////////////////////////////////////////////////////////
  16. // CAboutDlg dialog used for App About
  17. class CAboutDlg : public CDialog
  18. {
  19. public:
  20. CAboutDlg();
  21. // Dialog Data
  22. //{{AFX_DATA(CAboutDlg)
  23. enum { IDD = IDD_ABOUTBOX };
  24. //}}AFX_DATA
  25. // ClassWizard generated virtual function overrides
  26. //{{AFX_VIRTUAL(CAboutDlg)
  27. protected:
  28. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  29. //}}AFX_VIRTUAL
  30. // Implementation
  31. protected:
  32. //{{AFX_MSG(CAboutDlg)
  33. //}}AFX_MSG
  34. DECLARE_MESSAGE_MAP()
  35. };
  36. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  37. {
  38. //{{AFX_DATA_INIT(CAboutDlg)
  39. //}}AFX_DATA_INIT
  40. }
  41. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  42. {
  43. CDialog::DoDataExchange(pDX);
  44. //{{AFX_DATA_MAP(CAboutDlg)
  45. //}}AFX_DATA_MAP
  46. }
  47. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  48. //{{AFX_MSG_MAP(CAboutDlg)
  49. // No message handlers
  50. //}}AFX_MSG_MAP
  51. END_MESSAGE_MAP();
  52. /////////////////////////////////////////////////////////////////////////////
  53. // CMakeSetupDialog dialog
  54. CMakeSetupDialog::CMakeSetupDialog(CWnd* pParent /*=NULL*/)
  55. : CDialog(CMakeSetupDialog::IDD, pParent)
  56. {
  57. m_RegistryKey = "Software\\Kitware\\CMakeSetup\\Settings\\StartPath";
  58. //{{AFX_DATA_INIT(CMakeSetupDialog)
  59. m_WhereBuild = _T("");
  60. m_WhereSource = _T("");
  61. //}}AFX_DATA_INIT
  62. // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
  63. m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
  64. m_BuildPathChanged = false;
  65. }
  66. void CMakeSetupDialog::DoDataExchange(CDataExchange* pDX)
  67. {
  68. CDialog::DoDataExchange(pDX);
  69. //{{AFX_DATA_MAP(CMakeSetupDialog)
  70. DDX_Control(pDX, IDC_WhereSource, m_WhereSourceControl);
  71. DDX_Control(pDX, IDC_WhereBuild, m_WhereBuildControl);
  72. DDX_Control(pDX, IDC_LIST2, m_CacheEntriesList);
  73. DDX_CBString(pDX, IDC_WhereBuild, m_WhereBuild);
  74. DDX_CBString(pDX, IDC_WhereSource, m_WhereSource);
  75. //}}AFX_DATA_MAP
  76. }
  77. BEGIN_MESSAGE_MAP(CMakeSetupDialog, CDialog)
  78. //{{AFX_MSG_MAP(CMakeSetupDialog)
  79. ON_WM_SYSCOMMAND()
  80. ON_WM_PAINT()
  81. ON_WM_QUERYDRAGICON()
  82. ON_BN_CLICKED(IDC_BuildProjects, OnBuildProjects)
  83. ON_CBN_EDITCHANGE(IDC_WhereBuild, OnChangeWhereBuild)
  84. ON_BN_CLICKED(IDC_BUTTON2, OnBrowseWhereSource)
  85. ON_BN_CLICKED(IDC_BUTTON3, OnBrowseWhereBuild)
  86. ON_CBN_SELENDOK(IDC_WhereBuild, OnSelendokWhereBuild)
  87. ON_CBN_SELENDOK(IDC_WhereSource, OnSelendokWhereSource)
  88. ON_CBN_EDITCHANGE(IDC_WhereSource, OnChangeWhereSource)
  89. //}}AFX_MSG_MAP
  90. END_MESSAGE_MAP()
  91. /////////////////////////////////////////////////////////////////////////////
  92. // CMakeSetupDialog message handlers
  93. BOOL CMakeSetupDialog::OnInitDialog()
  94. {
  95. CDialog::OnInitDialog();
  96. // Add "About..." menu item to system menu.
  97. // IDM_ABOUTBOX must be in the system command range.
  98. ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
  99. ASSERT(IDM_ABOUTBOX < 0xF000);
  100. CMenu* pSysMenu = GetSystemMenu(FALSE);
  101. if (pSysMenu != NULL)
  102. {
  103. CString strAboutMenu;
  104. strAboutMenu.LoadString(IDS_ABOUTBOX);
  105. if (!strAboutMenu.IsEmpty())
  106. {
  107. pSysMenu->AppendMenu(MF_SEPARATOR);
  108. pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
  109. }
  110. }
  111. // Set the icon for this dialog. The framework does this automatically
  112. // when the application's main window is not a dialog
  113. SetIcon(m_hIcon, TRUE); // Set big icon
  114. SetIcon(m_hIcon, FALSE); // Set small icon
  115. // Load source and build dirs from registry
  116. this->LoadFromRegistry();
  117. // try to load the cmake cache from disk
  118. this->LoadCacheFromDiskToGUI();
  119. return TRUE; // return TRUE unless you set the focus to a control
  120. }
  121. // About dialog invoke
  122. void CMakeSetupDialog::OnSysCommand(UINT nID, LPARAM lParam)
  123. {
  124. if ((nID & 0xFFF0) == IDM_ABOUTBOX)
  125. {
  126. CAboutDlg dlgAbout;
  127. dlgAbout.DoModal();
  128. }
  129. else
  130. {
  131. CDialog::OnSysCommand(nID, lParam);
  132. }
  133. }
  134. // If you add a minimize button to your dialog, you will need the code below
  135. // to draw the icon. For MFC applications using the document/view model,
  136. // this is automatically done for you by the framework.
  137. void CMakeSetupDialog::OnPaint()
  138. {
  139. if (IsIconic())
  140. {
  141. CPaintDC dc(this); // device context for painting
  142. SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
  143. // Center icon in client rectangle
  144. int cxIcon = GetSystemMetrics(SM_CXICON);
  145. int cyIcon = GetSystemMetrics(SM_CYICON);
  146. CRect rect;
  147. GetClientRect(&rect);
  148. int x = (rect.Width() - cxIcon + 1) / 2;
  149. int y = (rect.Height() - cyIcon + 1) / 2;
  150. // Draw the icon
  151. dc.DrawIcon(x, y, m_hIcon);
  152. }
  153. else
  154. {
  155. CDialog::OnPaint();
  156. }
  157. }
  158. // The system calls this to obtain the cursor to display while the user drags
  159. // the minimized window.
  160. HCURSOR CMakeSetupDialog::OnQueryDragIcon()
  161. {
  162. return (HCURSOR) m_hIcon;
  163. }
  164. // Insane Microsoft way of setting the initial directory
  165. // for the Shbrowseforfolder function...
  166. // SetSelProc
  167. // Callback procedure to set the initial selection of the browser.
  168. int CALLBACK CMakeSetupDialog_SetSelProc( HWND hWnd, UINT uMsg,
  169. LPARAM lParam, LPARAM lpData )
  170. {
  171. if (uMsg==BFFM_INITIALIZED)
  172. {
  173. ::SendMessage(hWnd, BFFM_SETSELECTION, TRUE, lpData );
  174. }
  175. return 0;
  176. }
  177. // Browse button
  178. bool CMakeSetupDialog::Browse(CString &result, const char *title)
  179. {
  180. // don't know what to do with initial right now...
  181. char szPathName[4096];
  182. BROWSEINFO bi;
  183. bi.hwndOwner = m_hWnd;
  184. bi.pidlRoot = NULL;
  185. bi.pszDisplayName = (LPTSTR)szPathName;
  186. bi.lpszTitle = title;
  187. bi.ulFlags = BIF_BROWSEINCLUDEFILES;
  188. // set up initial directory code
  189. bi.lpfn = CMakeSetupDialog_SetSelProc;
  190. bi.lParam = (LPARAM)(LPCSTR) result;
  191. // open the directory chooser
  192. LPITEMIDLIST pidl = SHBrowseForFolder(&bi);
  193. // get the result
  194. bool bSuccess = (SHGetPathFromIDList(pidl, szPathName) ? true : false);
  195. if(bSuccess)
  196. {
  197. result = szPathName;
  198. }
  199. return bSuccess;
  200. }
  201. void CMakeSetupDialog::SaveToRegistry()
  202. {
  203. HKEY hKey;
  204. DWORD dwDummy;
  205. if(RegCreateKeyEx(HKEY_CURRENT_USER,
  206. m_RegistryKey,
  207. 0, "", REG_OPTION_NON_VOLATILE, KEY_READ|KEY_WRITE,
  208. NULL, &hKey, &dwDummy) != ERROR_SUCCESS)
  209. {
  210. return;
  211. }
  212. else
  213. {
  214. // load some values
  215. CString regvalue;
  216. this->ReadRegistryValue(hKey, &(regvalue),"WhereSource","C:\\");
  217. if(m_WhereSource != regvalue)
  218. {
  219. regvalue = "";
  220. this->ReadRegistryValue(hKey, &(regvalue),"WhereSource3","");
  221. RegSetValueEx(hKey, _T("WhereSource4"), 0, REG_SZ,
  222. (CONST BYTE *)(const char *)regvalue,
  223. regvalue.GetLength());
  224. regvalue = "";
  225. this->ReadRegistryValue(hKey, &(regvalue),"WhereSource2","");
  226. RegSetValueEx(hKey, _T("WhereSource3"), 0, REG_SZ,
  227. (CONST BYTE *)(const char *)regvalue,
  228. regvalue.GetLength());
  229. regvalue = "";
  230. this->ReadRegistryValue(hKey, &(regvalue),"WhereSource","");
  231. RegSetValueEx(hKey, _T("WhereSource2"), 0, REG_SZ,
  232. (CONST BYTE *)(const char *)regvalue,
  233. regvalue.GetLength());
  234. RegSetValueEx(hKey, _T("WhereSource"), 0, REG_SZ,
  235. (CONST BYTE *)(const char *)m_WhereSource,
  236. m_WhereSource.GetLength());
  237. }
  238. this->ReadRegistryValue(hKey, &(regvalue),"WhereBuild","C:\\");
  239. if(m_WhereBuild != regvalue)
  240. {
  241. regvalue = "";
  242. this->ReadRegistryValue(hKey, &(regvalue),"WhereBuild3","");
  243. RegSetValueEx(hKey, _T("WhereBuild4"), 0, REG_SZ,
  244. (CONST BYTE *)(const char *)regvalue,
  245. regvalue.GetLength());
  246. regvalue = "";
  247. this->ReadRegistryValue(hKey, &(regvalue),"WhereBuild2","");
  248. RegSetValueEx(hKey, _T("WhereBuild3"), 0, REG_SZ,
  249. (CONST BYTE *)(const char *)regvalue,
  250. regvalue.GetLength());
  251. regvalue = "";
  252. this->ReadRegistryValue(hKey, &(regvalue),"WhereBuild","");
  253. RegSetValueEx(hKey, _T("WhereBuild2"), 0, REG_SZ,
  254. (CONST BYTE *)(const char *)regvalue,
  255. regvalue.GetLength());
  256. RegSetValueEx(hKey, _T("WhereBuild"), 0, REG_SZ,
  257. (CONST BYTE *)(const char *)m_WhereBuild,
  258. m_WhereBuild.GetLength());
  259. }
  260. }
  261. RegCloseKey(hKey);
  262. }
  263. void CMakeSetupDialog::ReadRegistryValue(HKEY hKey,
  264. CString *val,
  265. const char *key,
  266. const char *adefault)
  267. {
  268. DWORD dwType, dwSize;
  269. char *pb;
  270. dwType = REG_SZ;
  271. pb = val->GetBuffer(MAX_PATH);
  272. dwSize = MAX_PATH;
  273. if(RegQueryValueEx(hKey,_T(key), NULL, &dwType,
  274. (BYTE *)pb, &dwSize) != ERROR_SUCCESS)
  275. {
  276. val->ReleaseBuffer();
  277. *val = _T(adefault);
  278. }
  279. else
  280. {
  281. val->ReleaseBuffer();
  282. }
  283. }
  284. void CMakeSetupDialog::LoadFromRegistry()
  285. {
  286. HKEY hKey;
  287. if(RegOpenKeyEx(HKEY_CURRENT_USER,
  288. m_RegistryKey,
  289. 0, KEY_READ, &hKey) != ERROR_SUCCESS)
  290. {
  291. return;
  292. }
  293. else
  294. {
  295. // load some values
  296. this->ReadRegistryValue(hKey, &(m_WhereSource),"WhereSource","C:\\");
  297. this->ReadRegistryValue(hKey, &(m_WhereBuild),"WhereBuild","C:\\");
  298. m_WhereSourceControl.AddString(m_WhereSource);
  299. m_WhereBuildControl.AddString(m_WhereBuild);
  300. CString regvalue;
  301. this->ReadRegistryValue(hKey, &(regvalue),"WhereSource2","C:\\");
  302. m_WhereSourceControl.AddString(regvalue);
  303. regvalue = "";
  304. this->ReadRegistryValue(hKey, &(regvalue),"WhereBuild2","C:\\");
  305. m_WhereBuildControl.AddString(regvalue);
  306. regvalue = "";
  307. this->ReadRegistryValue(hKey, &(regvalue),"WhereSource3","C:\\");
  308. m_WhereSourceControl.AddString(regvalue);
  309. regvalue = "";
  310. this->ReadRegistryValue(hKey, &(regvalue),"WhereBuild3","C:\\");
  311. m_WhereBuildControl.AddString(regvalue);
  312. regvalue = "";
  313. this->ReadRegistryValue(hKey, &(regvalue),"WhereSource4","C:\\");
  314. m_WhereSourceControl.AddString(regvalue);
  315. regvalue = "";
  316. this->ReadRegistryValue(hKey, &(regvalue),"WhereBuild4","C:\\");
  317. m_WhereBuildControl.AddString(regvalue);
  318. }
  319. RegCloseKey(hKey);
  320. }
  321. // Callback for browse source button
  322. void CMakeSetupDialog::OnBrowseWhereSource()
  323. {
  324. this->UpdateData();
  325. Browse(m_WhereSource, "Enter Path to Source");
  326. this->UpdateData(false);
  327. this->OnChangeWhereSource();
  328. }
  329. // Callback for browser build button
  330. void CMakeSetupDialog::OnBrowseWhereBuild()
  331. {
  332. this->UpdateData();
  333. Browse(m_WhereBuild, "Enter Path to Build");
  334. this->UpdateData(false);
  335. this->OnChangeWhereBuild();
  336. }
  337. // Callback for build projects button
  338. void CMakeSetupDialog::OnBuildProjects()
  339. {
  340. if(!cmSystemTools::FileExists(m_WhereBuild))
  341. {
  342. std::string message =
  343. "Build directory does not exist, should I create it?\n\n"
  344. "Directory: ";
  345. message += (const char*)m_WhereBuild;
  346. if(MessageBox(message.c_str(), "Create Directory", MB_OKCANCEL) == IDOK)
  347. {
  348. cmSystemTools::MakeDirectory(m_WhereBuild);
  349. }
  350. else
  351. {
  352. MessageBox("Build Project aborted, nothing done.");
  353. return;
  354. }
  355. }
  356. ::SetCursor(LoadCursor(NULL, IDC_WAIT));
  357. // get all the info from the screen
  358. this->UpdateData();
  359. if(!m_BuildPathChanged)
  360. {
  361. // if the build path has not changed save the
  362. // current GUI values to the cache
  363. this->SaveCacheFromGUI();
  364. }
  365. // Make sure we are working from the cache on disk
  366. this->LoadCacheFromDiskToGUI();
  367. // duh
  368. // Create a makefile object
  369. cmMakefile makefile;
  370. makefile.SetMakefileGenerator(new cmMSProjectGenerator);
  371. makefile.SetHomeDirectory(m_WhereSource);
  372. makefile.SetStartOutputDirectory(m_WhereBuild);
  373. makefile.SetHomeOutputDirectory(m_WhereBuild);
  374. makefile.SetStartDirectory(m_WhereSource);
  375. makefile.MakeStartDirectoriesCurrent();
  376. CString makefileIn = m_WhereSource;
  377. makefileIn += "/CMakeLists.txt";
  378. makefile.ReadListFile(makefileIn);
  379. if(!cmCacheManager::GetInstance()->GetCacheValue("CMAKE_CXX"))
  380. {
  381. if(!makefile.GetDefinition("CMAKE_CXX"))
  382. {
  383. makefile.AddDefinition("CMAKE_CXX", "VC60");
  384. }
  385. cmCacheManager::GetInstance()->AddCacheEntry("CMAKE_CXX", "VC60",
  386. "Compiler used", cmCacheManager::STRING);
  387. }
  388. // Generate the project files
  389. makefile.GenerateMakefile();
  390. // Save the cache
  391. cmCacheManager::GetInstance()->SaveCache(&makefile);
  392. // end duh
  393. // update the GUI with any new values in the caused by the
  394. // generation process
  395. this->LoadCacheFromDiskToGUI();
  396. cmCacheManager::GetInstance()->DefineCache(&makefile);
  397. // save source and build paths to registry
  398. this->SaveToRegistry();
  399. // path is not up-to-date
  400. m_BuildPathChanged = false;
  401. ::SetCursor(LoadCursor(NULL, IDC_ARROW));
  402. }
  403. // callback for combo box menu where build selection
  404. void CMakeSetupDialog::OnSelendokWhereBuild()
  405. {
  406. m_WhereBuildControl.GetLBText(m_WhereBuildControl.GetCurSel(), m_WhereBuild);
  407. this->UpdateData(FALSE);
  408. this->OnChangeWhereBuild();
  409. }
  410. // callback for combo box menu where source selection
  411. void CMakeSetupDialog::OnSelendokWhereSource()
  412. {
  413. m_WhereSourceControl.GetLBText(m_WhereSourceControl.GetCurSel(), m_WhereSource);
  414. this->UpdateData(FALSE);
  415. this->OnChangeWhereSource();
  416. }
  417. // callback for chaing source directory
  418. void CMakeSetupDialog::OnChangeWhereSource()
  419. {
  420. }
  421. // callback for changing the build directory
  422. void CMakeSetupDialog::OnChangeWhereBuild()
  423. {
  424. this->UpdateData();
  425. std::string cachefile = m_WhereBuild;
  426. cachefile += "/CMakeCache.txt";
  427. m_CacheEntriesList.RemoveAll();
  428. if(cmSystemTools::FileExists(cachefile.c_str()))
  429. {
  430. m_CacheEntriesList.ShowWindow(SW_SHOW);
  431. this->LoadCacheFromDiskToGUI();
  432. m_BuildPathChanged = true;
  433. }
  434. }
  435. // copy from the cache manager to the cache edit list box
  436. void CMakeSetupDialog::FillCacheGUIFromCacheManager()
  437. {
  438. const cmCacheManager::CacheEntryMap &cache =
  439. cmCacheManager::GetInstance()->GetCacheMap();
  440. for(cmCacheManager::CacheEntryMap::const_iterator i = cache.begin();
  441. i != cache.end(); ++i)
  442. {
  443. const char* key = i->first.c_str();
  444. const cmCacheManager::CacheEntry& value = i->second;
  445. switch(value.m_Type )
  446. {
  447. case cmCacheManager::BOOL:
  448. if(cmCacheManager::GetInstance()->IsOn(key))
  449. {
  450. m_CacheEntriesList.AddProperty(key,
  451. "ON",
  452. value.m_HelpString.c_str(),
  453. CPropertyList::CHECKBOX,"");
  454. }
  455. else
  456. {
  457. m_CacheEntriesList.AddProperty(key,
  458. "OFF",
  459. value.m_HelpString.c_str(),
  460. CPropertyList::CHECKBOX,"");
  461. }
  462. break;
  463. case cmCacheManager::PATH:
  464. m_CacheEntriesList.AddProperty(key,
  465. value.m_Value.c_str(),
  466. value.m_HelpString.c_str(),
  467. CPropertyList::PATH,"");
  468. break;
  469. case cmCacheManager::FILEPATH:
  470. m_CacheEntriesList.AddProperty(key,
  471. value.m_Value.c_str(),
  472. value.m_HelpString.c_str(),
  473. CPropertyList::FILE,"");
  474. break;
  475. case cmCacheManager::STRING:
  476. m_CacheEntriesList.AddProperty(key,
  477. value.m_Value.c_str(),
  478. value.m_HelpString.c_str(),
  479. CPropertyList::EDIT,"");
  480. break;
  481. case cmCacheManager::INTERNAL:
  482. break;
  483. }
  484. }
  485. this->UpdateData(FALSE);
  486. }
  487. // copy from the list box to the cache manager
  488. void CMakeSetupDialog::FillCacheManagerFromCacheGUI()
  489. {
  490. cmCacheManager::GetInstance()->GetCacheMap();
  491. std::set<CPropertyItem*> items = m_CacheEntriesList.GetItems();
  492. for(std::set<CPropertyItem*>::iterator i = items.begin();
  493. i != items.end(); ++i)
  494. {
  495. CPropertyItem* item = *i;
  496. cmCacheManager::CacheEntry *entry =
  497. cmCacheManager::GetInstance()->GetCacheEntry((const char*)item->m_propName);
  498. if (entry)
  499. {
  500. entry->m_Value = item->m_curValue;
  501. }
  502. }
  503. }
  504. //! Load cache file from m_WhereBuild and display in GUI editor
  505. void CMakeSetupDialog::LoadCacheFromDiskToGUI()
  506. {
  507. if(m_WhereBuild != "")
  508. {
  509. cmCacheManager::GetInstance()->LoadCache(m_WhereBuild);
  510. // Find our own exectuable.
  511. char fname[1024];
  512. ::GetModuleFileName(NULL,fname,1023);
  513. std::string root = cmSystemTools::GetProgramPath(fname);
  514. std::string::size_type slashPos = root.rfind("/");
  515. if(slashPos != std::string::npos)
  516. {
  517. root = root.substr(0, slashPos);
  518. }
  519. cmCacheManager::GetInstance()->AddCacheEntry
  520. ("CMAKE_ROOT", root.c_str(),
  521. "Path to CMake installation.", cmCacheManager::INTERNAL);
  522. std::string cMakeCMD = "\""+cmSystemTools::GetProgramPath(fname);
  523. cMakeCMD += "/cmake.exe\"";
  524. // Save the value in the cache
  525. cmCacheManager::GetInstance()->AddCacheEntry("CMAKE_COMMAND",
  526. cMakeCMD.c_str(),
  527. "Path to CMake executable.",
  528. cmCacheManager::INTERNAL);
  529. this->FillCacheGUIFromCacheManager();
  530. }
  531. }
  532. //! Save GUI values to cmCacheManager and then save to disk.
  533. void CMakeSetupDialog::SaveCacheFromGUI()
  534. {
  535. this->FillCacheManagerFromCacheGUI();
  536. if(m_WhereBuild != "")
  537. {
  538. cmCacheManager::GetInstance()->SaveCache(m_WhereBuild);
  539. }
  540. }