summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/MFCDialog/CMakeDialog.h73
-rw-r--r--Source/MFCDialog/CMakeSetup.rc5
-rw-r--r--Source/MFCDialog/CMakeSetupDialog.cpp107
-rw-r--r--Source/MFCDialog/CMakeSetupDialog.h20
-rw-r--r--Source/MFCDialog/PropertyList.cpp44
-rw-r--r--Source/MFCDialog/PropertyList.h8
-rw-r--r--Source/MFCDialog/resource.h4
-rw-r--r--Source/cmMakefile.cxx10
-rw-r--r--Source/cmMakefile.h7
-rw-r--r--Source/cmake.cxx22
-rw-r--r--Source/cmake.h4
11 files changed, 174 insertions, 130 deletions
diff --git a/Source/MFCDialog/CMakeDialog.h b/Source/MFCDialog/CMakeDialog.h
deleted file mode 100644
index 30fe5fb..0000000
--- a/Source/MFCDialog/CMakeDialog.h
+++ /dev/null
@@ -1,73 +0,0 @@
-// CMakeSetupDialogDlg.h : header file
-//
-
-#if !defined(AFX_CMakeSetupDialogDLG_H__AC17A6F6_4634_11D4_8F21_00A0CC33FCD3__INCLUDED_)
-#define AFX_CMakeSetupDialogDLG_H__AC17A6F6_4634_11D4_8F21_00A0CC33FCD3__INCLUDED_
-
-#if _MSC_VER > 1000
-#pragma once
-#endif // _MSC_VER > 1000
-
-/////////////////////////////////////////////////////////////////////////////
-// CMakeSetupDialog dialog
-
-class CMakeSetupDialog : public CDialog
-{
-// Construction
-public:
- CMakeSetupDialog(CWnd* pParent = NULL); // standard constructor
-protected:
- bool Browse(CString&, const char* title);
- void SaveToRegistry();
- void LoadFromRegistry();
- void ReadRegistryValue(HKEY hKey,
- CString *val,
- char *key,
- char *adefault);
-// Dialog Data
- //{{AFX_DATA(CMakeSetupDialog)
- enum { IDD = IDD_CMakeSetupDialog_DIALOG };
- CButton m_CancelButton;
- CStatic m_MouseHelp;
- CStatic m_VersionDisplay;
- CButton m_BuildProjects;
- CButton m_ListFrame;
- CComboBox m_WhereSourceControl;
- CComboBox m_WhereBuildControl;
- CListBox m_CacheEntriesList;
- CString m_WhereITK;
- CString m_WhereBuildITK;
- CString m_WhereBuild;
- CString m_WhereSource;
- //}}AFX_DATA
-
- // ClassWizard generated virtual function overrides
- //{{AFX_VIRTUAL(CMakeSetupDialog)
-protected:
- virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
- //}}AFX_VIRTUAL
-
-// Implementation
-protected:
- HICON m_hIcon;
-
- // Generated message map functions
- //{{AFX_MSG(CMakeSetupDialog)
- virtual BOOL OnInitDialog();
- afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
- afx_msg void OnPaint();
- afx_msg HCURSOR OnQueryDragIcon();
- virtual void OnOK();
- afx_msg void OnBuildProjects();
- afx_msg void OnChangeWhereBuild();
- afx_msg void OnChangeWhereSource();
- afx_msg void OnSelendokWhereBuild();
- afx_msg void OnSize(UINT nType, int cx, int cy);
- //}}AFX_MSG
- DECLARE_MESSAGE_MAP()
-};
-
-//{{AFX_INSERT_LOCATION}}
-// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
-
-#endif // !defined(AFX_CMakeSetupDialogDLG_H__AC17A6F6_4634_11D4_8F21_00A0CC33FCD3__INCLUDED_)
diff --git a/Source/MFCDialog/CMakeSetup.rc b/Source/MFCDialog/CMakeSetup.rc
index 35e5347..20ca197 100644
--- a/Source/MFCDialog/CMakeSetup.rc
+++ b/Source/MFCDialog/CMakeSetup.rc
@@ -98,8 +98,8 @@ BEGIN
COMBOBOX IDC_WhereBuild,148,26,133,68,CBS_DROPDOWN |
CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Browse...",IDC_BUTTON3,286,25,43,13
- DEFPUSHBUTTON "Build Project Files",IDC_BuildProjects,112,206,67,15
- PUSHBUTTON "Close",IDOK,190,206,67,15
+ DEFPUSHBUTTON "Configure",IDC_BuildProjects,88,202,67,15
+ PUSHBUTTON "Cancel",IDCANCEL,220,201,67,15
LISTBOX IDC_LIST2,15,55,344,122,LBS_OWNERDRAWVARIABLE |
LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL |
WS_HSCROLL
@@ -110,6 +110,7 @@ BEGIN
CTEXT "Right click on cache entries for additional options",
IDC_MouseHelpCaption,106,189,156,8
LTEXT "Static",IDC_CMAKE_VERSION,3,211,58,13,SS_CENTERIMAGE
+ PUSHBUTTON "OK",IDC_OK,160,202,56,14
END
diff --git a/Source/MFCDialog/CMakeSetupDialog.cpp b/Source/MFCDialog/CMakeSetupDialog.cpp
index d9ca2de..635be38 100644
--- a/Source/MFCDialog/CMakeSetupDialog.cpp
+++ b/Source/MFCDialog/CMakeSetupDialog.cpp
@@ -68,8 +68,8 @@ CMakeSetupDialog::CMakeSetupDialog(CWnd* pParent /*=NULL*/)
m_RegistryKey = "Software\\Kitware\\CMakeSetup\\Settings\\StartPath";
//{{AFX_DATA_INIT(CMakeSetupDialog)
- m_WhereBuild = _T("");
m_WhereSource = _T("");
+ m_WhereBuild = _T("");
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
@@ -90,16 +90,17 @@ void CMakeSetupDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMakeSetupDialog)
- DDX_Control(pDX, IDOK, m_CancelButton);
- DDX_Control(pDX, IDC_MouseHelpCaption, m_MouseHelp);
- DDX_Control(pDX, IDC_CMAKE_VERSION, m_VersionDisplay);
- DDX_Control(pDX, IDC_BuildProjects, m_BuildProjects);
+ DDX_Control(pDX, IDC_OK, m_OKButton);
+ DDX_Control(pDX, IDCANCEL, m_CancelButton);
+ DDX_CBStringExact(pDX, IDC_WhereSource, m_WhereSource);
+ DDX_CBStringExact(pDX, IDC_WhereBuild, m_WhereBuild);
DDX_Control(pDX, IDC_FRAME, m_ListFrame);
DDX_Control(pDX, IDC_WhereSource, m_WhereSourceControl);
DDX_Control(pDX, IDC_WhereBuild, m_WhereBuildControl);
DDX_Control(pDX, IDC_LIST2, m_CacheEntriesList);
- DDX_CBStringExact(pDX, IDC_WhereBuild, m_WhereBuild);
- DDX_CBStringExact(pDX, IDC_WhereSource, m_WhereSource);
+ DDX_Control(pDX, IDC_MouseHelpCaption, m_MouseHelp);
+ DDX_Control(pDX, IDC_CMAKE_VERSION, m_VersionDisplay);
+ DDX_Control(pDX, IDC_BuildProjects, m_Configure);
//}}AFX_DATA_MAP
}
@@ -108,16 +109,17 @@ BEGIN_MESSAGE_MAP(CMakeSetupDialog, CDialog)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
- ON_BN_CLICKED(IDOK, OnOK)
- ON_BN_CLICKED(IDC_BuildProjects, OnBuildProjects)
- ON_CBN_EDITCHANGE(IDC_WhereBuild, OnChangeWhereBuild)
- ON_CBN_EDITCHANGE(IDC_WhereSource, OnChangeWhereSource)
- ON_CBN_SELCHANGE(IDC_WhereBuild, OnSelendokWhereBuild)
ON_BN_CLICKED(IDC_BUTTON2, OnBrowseWhereSource)
+ ON_BN_CLICKED(IDC_BuildProjects, OnConfigure)
ON_BN_CLICKED(IDC_BUTTON3, OnBrowseWhereBuild)
+ ON_CBN_EDITCHANGE(IDC_WhereBuild, OnChangeWhereBuild)
+ ON_CBN_SELCHANGE(IDC_WhereBuild, OnSelendokWhereBuild)
+ ON_CBN_EDITCHANGE(IDC_WhereSource, OnChangeWhereSource)
ON_CBN_SELENDOK(IDC_WhereSource, OnSelendokWhereSource)
ON_WM_SIZE()
ON_WM_GETMINMAXINFO()
+ ON_BN_CLICKED(IDCANCEL, OnCancel)
+ ON_BN_CLICKED(IDC_OK, OnOk)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
@@ -162,6 +164,7 @@ BOOL CMakeSetupDialog::OnInitDialog()
cmMakefile::GetMinorVersion());
SetDlgItemText(IDC_CMAKE_VERSION, tmp);
this->UpdateData(FALSE);
+ m_OKButton.EnableWindow(false);
return TRUE; // return TRUE unless you set the focus to a control
}
@@ -386,10 +389,9 @@ void CMakeSetupDialog::OnBrowseWhereBuild()
this->OnChangeWhereBuild();
}
-// Callback for build projects button
-void CMakeSetupDialog::OnBuildProjects()
+void CMakeSetupDialog::RunCMake(bool generateProjectFiles)
{
- if(!cmSystemTools::FileExists(m_WhereBuild))
+ if(!cmSystemTools::FileExists(m_WhereBuild))
{
std::string message =
"Build directory does not exist, should I create it?\n\n"
@@ -431,7 +433,7 @@ void CMakeSetupDialog::OnBuildProjects()
arg += m_WhereBuild;
args.push_back(arg);
// run the generate process
- if(make.Generate(args) != 0)
+ if(make.Generate(args, generateProjectFiles) != 0)
{
cmSystemTools::Error(
"Error in generation process, project files may be invalid");
@@ -446,7 +448,15 @@ void CMakeSetupDialog::OnBuildProjects()
m_BuildPathChanged = false;
// put the cursor back
::SetCursor(LoadCursor(NULL, IDC_ARROW));
- m_CacheEntriesList.ClearDirty();
+}
+
+
+// Callback for build projects button
+void CMakeSetupDialog::OnConfigure()
+{
+ this->RunCMake(false);
+ // if cache has values then enb
+ m_OKButton.EnableWindow(true);
}
@@ -489,7 +499,24 @@ void CMakeSetupDialog::OnChangeWhereBuild()
// copy from the cache manager to the cache edit list box
void CMakeSetupDialog::FillCacheGUIFromCacheManager()
-{
+{
+ int size = m_CacheEntriesList.GetItems().size();
+ bool reverseOrder = false;
+ // if there are already entries in the cache, then
+ // put the new ones in the top, so they show up first
+ if(size)
+ {
+ reverseOrder = true;
+ }
+
+ // all the current values are not new any more
+ std::set<CPropertyItem*> items = m_CacheEntriesList.GetItems();
+ for(std::set<CPropertyItem*>::iterator i = items.begin();
+ i != items.end(); ++i)
+ {
+ CPropertyItem* item = *i;
+ item->m_NewValue = false;
+ }
const cmCacheManager::CacheEntryMap &cache =
cmCacheManager::GetInstance()->GetCacheMap();
for(cmCacheManager::CacheEntryMap::const_iterator i = cache.begin();
@@ -505,38 +532,51 @@ void CMakeSetupDialog::FillCacheGUIFromCacheManager()
m_CacheEntriesList.AddProperty(key,
"ON",
value.m_HelpString.c_str(),
- CPropertyList::CHECKBOX,"");
+ CPropertyList::CHECKBOX,"",
+ reverseOrder
+ );
}
else
{
m_CacheEntriesList.AddProperty(key,
"OFF",
value.m_HelpString.c_str(),
- CPropertyList::CHECKBOX,"");
+ CPropertyList::CHECKBOX,"",
+ reverseOrder
+ );
}
break;
case cmCacheManager::PATH:
m_CacheEntriesList.AddProperty(key,
value.m_Value.c_str(),
value.m_HelpString.c_str(),
- CPropertyList::PATH,"");
+ CPropertyList::PATH,"",
+ reverseOrder
+ );
break;
case cmCacheManager::FILEPATH:
m_CacheEntriesList.AddProperty(key,
value.m_Value.c_str(),
value.m_HelpString.c_str(),
- CPropertyList::FILE,"");
+ CPropertyList::FILE,"",
+ reverseOrder
+ );
break;
case cmCacheManager::STRING:
m_CacheEntriesList.AddProperty(key,
value.m_Value.c_str(),
value.m_HelpString.c_str(),
- CPropertyList::EDIT,"");
+ CPropertyList::EDIT,"",
+ reverseOrder
+ );
break;
case cmCacheManager::INTERNAL:
break;
}
}
+ // redraw the list
+ m_CacheEntriesList.SetTopIndex(0);
+ m_CacheEntriesList.Invalidate();
}
// copy from the list box to the cache manager
@@ -633,9 +673,9 @@ void CMakeSetupDialog::OnSize(UINT nType, int cx, int cy)
0, 0,
SWP_NOSIZE | SWP_NOZORDER);
- m_BuildProjects.GetWindowRect(&cRect);
+ m_Configure.GetWindowRect(&cRect);
this->ScreenToClient(&cRect);
- m_BuildProjects.SetWindowPos(&wndTop, cRect.left + deltax/2,
+ m_Configure.SetWindowPos(&wndTop, cRect.left + deltax/2,
cRect.top + deltay,
0, 0,
SWP_NOSIZE | SWP_NOZORDER);
@@ -645,6 +685,12 @@ void CMakeSetupDialog::OnSize(UINT nType, int cx, int cy)
cRect.top + deltay,
0, 0,
SWP_NOSIZE | SWP_NOZORDER);
+ m_OKButton.GetWindowRect(&cRect);
+ this->ScreenToClient(&cRect);
+ m_OKButton.SetWindowPos(&wndTop, cRect.left + deltax/2,
+ cRect.top + deltay,
+ 0, 0,
+ SWP_NOSIZE | SWP_NOZORDER);
}
}
@@ -656,9 +702,9 @@ void CMakeSetupDialog::OnGetMinMaxInfo( MINMAXINFO FAR* lpMMI )
lpMMI->ptMinTrackSize.y = 272;
}
-void CMakeSetupDialog::OnOK()
+void CMakeSetupDialog::OnCancel()
{
- if(m_CacheEntriesList.IsDirty())
+ if(m_OKButton.IsWindowEnabled())
{
if(MessageBox("You have changed options but not rebuilt, "
"are you sure you want to exit?", "Confirm Exit",
@@ -672,3 +718,10 @@ void CMakeSetupDialog::OnOK()
CDialog::OnOK();
}
}
+
+void CMakeSetupDialog::OnOk()
+{
+ m_CacheEntriesList.ClearDirty();
+ this->RunCMake(true);
+ CDialog::OnOK();
+}
diff --git a/Source/MFCDialog/CMakeSetupDialog.h b/Source/MFCDialog/CMakeSetupDialog.h
index aa959d7..bb084d6 100644
--- a/Source/MFCDialog/CMakeSetupDialog.h
+++ b/Source/MFCDialog/CMakeSetupDialog.h
@@ -32,7 +32,9 @@ protected:
const char *aadefault);
// Dialog Data
//{{AFX_DATA(CMakeSetupDialog)
- enum { IDD = IDD_CMakeSetupDialog_DIALOG };
+ enum { IDD = IDD_CMakeSetupDialog_DIALOG };
+ CButton m_OKButton;
+ CButton m_CancelButton;
CString m_WhereSource;
CString m_WhereBuild;
CButton m_ListFrame;
@@ -42,9 +44,8 @@ protected:
CPropertyList m_CacheEntriesList;
CStatic m_MouseHelp;
CStatic m_VersionDisplay;
- CButton m_BuildProjects;
- CButton m_CancelButton;
- //}}AFX_DATA
+ CButton m_Configure;
+ //}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMakeSetupDialog)
@@ -54,7 +55,7 @@ protected:
// Implementation
protected:
-
+ void RunCMake(bool generateProjectFiles);
// copy from the cache manager to the cache edit list box
void FillCacheGUIFromCacheManager();
// copy from the list box to the cache manager
@@ -68,11 +69,11 @@ protected:
//{{AFX_MSG(CMakeSetupDialog)
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
- afx_msg void OnOK();
+ afx_msg void OnCancel();
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg void OnBrowseWhereSource();
- virtual void OnBuildProjects();
+ virtual void OnConfigure();
afx_msg void OnBrowseWhereBuild();
afx_msg void OnChangeWhereBuild();
afx_msg void OnSelendokWhereBuild();
@@ -80,9 +81,10 @@ protected:
afx_msg void OnSelendokWhereSource();
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnGetMinMaxInfo( MINMAXINFO FAR* lpMMI );
- //}}AFX_MSG
+ afx_msg void OnOk();
+ //}}AFX_MSG
DECLARE_MESSAGE_MAP()
-
+
int m_oldCX;
int m_oldCY;
float m_deltaXRemainder;
diff --git a/Source/MFCDialog/PropertyList.cpp b/Source/MFCDialog/PropertyList.cpp
index ebb26de..f60d423 100644
--- a/Source/MFCDialog/PropertyList.cpp
+++ b/Source/MFCDialog/PropertyList.cpp
@@ -91,13 +91,21 @@ void CPropertyList::DrawItem(LPDRAWITEMSTRUCT lpDIS)
if (nIndex != (UINT) -1)
{
+ //get the CPropertyItem for the current row
+ CPropertyItem* pItem = (CPropertyItem*) GetItemDataPtr(nIndex);
//draw two rectangles, one for each row column
- dc.FillSolidRect(rect2,RGB(192,192,192));
+ if(pItem->m_NewValue)
+ {
+ dc.FillSolidRect(rect2,RGB(255,100, 100));
+ }
+ else
+ {
+ dc.FillSolidRect(rect2,RGB(192,192,192));
+ }
+
dc.DrawEdge(rect2,EDGE_SUNKEN,BF_BOTTOMRIGHT);
dc.DrawEdge(rect,EDGE_SUNKEN,BF_BOTTOM);
- //get the CPropertyItem for the current row
- CPropertyItem* pItem = (CPropertyItem*) GetItemDataPtr(nIndex);
//write the property name in the first rectangle
dc.SetBkMode(TRANSPARENT);
@@ -119,9 +127,18 @@ int CPropertyList::AddItem(CString txt)
return nIndex;
}
-int CPropertyList::AddPropItem(CPropertyItem* pItem)
+int CPropertyList::AddPropItem(CPropertyItem* pItem, bool reverseOrder)
{
- int nIndex = AddString(_T(""));
+ this->HideControls();
+ int nIndex;
+ if(reverseOrder)
+ {
+ nIndex = InsertString(0, _T(""));
+ }
+ else
+ {
+ nIndex = AddString(_T(""));
+ }
SetItemDataPtr(nIndex,pItem);
m_PropertyItems.insert(pItem);
return nIndex;
@@ -131,7 +148,7 @@ int CPropertyList::AddProperty(const char* name,
const char* value,
const char* helpString,
int type,
- const char* comboItems)
+ const char* comboItems, bool reverseOrder)
{
CPropertyItem* pItem = 0;
for(int i =0; i < this->GetCount(); ++i)
@@ -153,8 +170,9 @@ int CPropertyList::AddProperty(const char* name,
if(!pItem)
{
pItem = new CPropertyItem(name, value, helpString, type, comboItems);
+ pItem->m_NewValue = true;
}
- return this->AddPropItem(pItem);
+ return this->AddPropItem(pItem, reverseOrder);
}
int CPropertyList::OnCreate(LPCREATESTRUCT lpCreateStruct)
@@ -357,7 +375,7 @@ void CPropertyList::OnChangeEditBox()
}
}
-void CPropertyList::OnVScroll( UINT nSBCode, UINT nPos, CScrollBar* pScrollBar )
+void CPropertyList::HideControls()
{
if(m_editBox)
{
@@ -375,6 +393,11 @@ void CPropertyList::OnVScroll( UINT nSBCode, UINT nPos, CScrollBar* pScrollBar )
{
m_btnCtrl.ShowWindow(SW_HIDE);
}
+}
+
+void CPropertyList::OnVScroll( UINT nSBCode, UINT nPos, CScrollBar* pScrollBar )
+{
+ this->HideControls();
CListBox::OnVScroll(nSBCode, nPos, pScrollBar);
}
@@ -601,8 +624,10 @@ void CPropertyList::OnDelete()
CPropertyItem* pItem = (CPropertyItem*) GetItemDataPtr(m_curSel);
cmCacheManager::GetInstance()->RemoveCacheEntry(pItem->m_propName);
m_PropertyItems.erase(pItem);
- delete pItem;
+ delete pItem;
this->DeleteString(m_curSel);
+ this->HideControls();
+ this->SetTopIndex(0);
InvalidateList();
}
@@ -627,6 +652,7 @@ void CPropertyList::RemoveAll()
delete pItem;
this->DeleteString(0);
}
+ this->HideControls();
InvalidateList();
}
diff --git a/Source/MFCDialog/PropertyList.h b/Source/MFCDialog/PropertyList.h
index 9224e6d..3db0474 100644
--- a/Source/MFCDialog/PropertyList.h
+++ b/Source/MFCDialog/PropertyList.h
@@ -16,12 +16,14 @@ public:
CString m_curValue;
int m_nItemType;
CString m_cmbItems;
+ bool m_NewValue;
bool m_Removed;
public:
CPropertyItem(CString propName, CString curValue,
CString helpString,
int nItemType, CString cmbItems)
{
+ m_NewValue = true;
m_HelpString = helpString;
m_Removed = false;
m_propName = propName;
@@ -63,7 +65,9 @@ public:
const char* value,
const char* helpString,
int type,
- const char* comboItems);
+ const char* comboItems,
+ bool reverseOrder);
+ void HideControls();
std::set<CPropertyItem*> GetItems()
{
return m_PropertyItems;
@@ -111,7 +115,7 @@ protected:
void InvertLine(CDC* pDC,CPoint ptFrom,CPoint ptTo);
void DisplayButton(CRect region);
- int AddPropItem(CPropertyItem* pItem);
+ int AddPropItem(CPropertyItem* pItem, bool top);
void InvalidateList();
CComboBox m_cmbBox;
diff --git a/Source/MFCDialog/resource.h b/Source/MFCDialog/resource.h
index faa5626..b899c8b 100644
--- a/Source/MFCDialog/resource.h
+++ b/Source/MFCDialog/resource.h
@@ -17,7 +17,7 @@
#define IDC_CMAKE_VERSION 1014
#define IDC_FRAME 1015
#define IDC_MouseHelpCaption 1016
-#define IDC_CompilingText 1017
+#define IDC_OK 1018
// Next default values for new objects
//
@@ -25,7 +25,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 133
#define _APS_NEXT_COMMAND_VALUE 32771
-#define _APS_NEXT_CONTROL_VALUE 1018
+#define _APS_NEXT_CONTROL_VALUE 1019
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 3fc0d96..5c8aad2 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -404,8 +404,7 @@ void cmMakefile::SetMakefileGenerator(cmMakefileGenerator* mf)
mf->SetMakefile(this);
}
- // Generate the output file
-void cmMakefile::GenerateMakefile()
+void cmMakefile::FinalPass()
{
// do all the variable expansions here
this->ExpandVariables();
@@ -416,6 +415,13 @@ void cmMakefile::GenerateMakefile()
{
(*i)->FinalPass();
}
+
+}
+
+ // Generate the output file
+void cmMakefile::GenerateMakefile()
+{
+ this->FinalPass();
// merge libraries
for (cmTargets::iterator l = m_Targets.begin();
l != m_Targets.end(); l++)
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 5907c25..1da89ec 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -118,7 +118,12 @@ public:
* Produce the output makefile.
*/
void GenerateMakefile();
-
+
+ /**
+ * run the final pass on all commands.
+ */
+ void FinalPass();
+
/**
* Print the object state to std::cout.
*/
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 9bab508..6b6673b 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -222,7 +222,7 @@ void cmake::AddCMakePaths(const std::vector<std::string>& args)
"Path to CMake installation.", cmCacheManager::INTERNAL);
}
-int cmake::Generate(const std::vector<std::string>& args)
+int cmake::Generate(const std::vector<std::string>& args, bool buildMakefiles)
{
if(args.size() == 1 && !cmSystemTools::FileExists("CMakeLists.txt"))
{
@@ -279,7 +279,25 @@ int cmake::Generate(const std::vector<std::string>& args)
this->Usage(args[0].c_str());
return -1;
}
- mf.GenerateMakefile();
+ // if buildMakefiles, then call GenerateMakefile
+ if(buildMakefiles)
+ {
+ mf.GenerateMakefile();
+ }
+ else // do not build, but let the commands finalize
+ {
+ std::vector<cmMakefile*> makefiles;
+ mf.FindSubDirectoryCMakeListsFiles(makefiles);
+ for(std::vector<cmMakefile*>::iterator i = makefiles.begin();
+ i != makefiles.end(); ++i)
+ {
+ cmMakefile* mf = *i;
+ mf->FinalPass();
+ delete mf;
+ }
+ mf.FinalPass();
+ }
+
// Before saving the cache
// if the project did not define one of the entries below, add them now
diff --git a/Source/cmake.h b/Source/cmake.h
index ac7a80d..5e272f9 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -60,8 +60,10 @@ class cmake
* to the command line version of cmake. For building a GUI,
* you would pass in the following arguments:
* /path/to/cmake -H/path/to/source -B/path/to/build
+ * If you only want to parse the CMakeLists.txt files,
+ * but not actually generate the makefiles, use buildMakefiles = false.
*/
- int Generate(const std::vector<std::string>&);
+ int Generate(const std::vector<std::string>&, bool buildMakefiles = true);
/**
* Generate the SourceFilesList from the SourceLists. This should only be