Add /A and /G command-line param to carry the value of "Show Advanced" and generator name in desktop shortcuts

This commit is contained in:
Sebastien Barre 2001-12-03 15:59:17 -05:00
parent 9214ad0ec6
commit 906f0a3339
3 changed files with 48 additions and 6 deletions

View File

@ -17,12 +17,34 @@ CMakeCommandLineInfo::CMakeCommandLineInfo()
{ {
m_WhereSource = _T(""); m_WhereSource = _T("");
m_WhereBuild = _T(""); m_WhereBuild = _T("");
m_AdvancedValues = FALSE;
m_GeneratorChoiceString = _T("");
} }
CMakeCommandLineInfo::~CMakeCommandLineInfo() CMakeCommandLineInfo::~CMakeCommandLineInfo()
{ {
} }
int CMakeCommandLineInfo::GetBoolValue(const CString& v) {
CString value = v;
value.MakeLower();
if (value == "1" ||
value == "on" ||
value == "true" ||
value == "yes")
{
return 1;
}
else if (value == "0" ||
value == "off" ||
value == "false" ||
value == "no")
{
return -1;
}
return 0;
}
/////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////
// Parse param // Parse param
@ -35,14 +57,29 @@ void CMakeCommandLineInfo::ParseParam(LPCTSTR lpszParam, BOOL bFlag, BOOL bLast)
if (sParam[1] == '=' || sParam[1] == ':') if (sParam[1] == '=' || sParam[1] == ':')
{ {
CString value(sParam.Right(sParam.GetLength() - 2)); CString value(sParam.Right(sParam.GetLength() - 2));
int res;
switch (sParam[0]) switch (sParam[0])
{ {
case 'H': case 'A':
m_WhereSource = value; res = CMakeCommandLineInfo::GetBoolValue(value);
if (res == 1)
{
m_AdvancedValues = TRUE;
}
else if (res == -1)
{
m_AdvancedValues = FALSE;
}
break; break;
case 'B': case 'B':
m_WhereBuild = value; m_WhereBuild = value;
break; break;
case 'G':
m_GeneratorChoiceString = value;
break;
case 'H':
m_WhereSource = value;
break;
} }
} }
} }

View File

@ -27,6 +27,8 @@ public:
public: public:
CString m_WhereSource; CString m_WhereSource;
CString m_WhereBuild; CString m_WhereBuild;
BOOL m_AdvancedValues;
CString m_GeneratorChoiceString;
// Operations // Operations
public: public:
@ -35,6 +37,8 @@ public:
// Implementation // Implementation
public: public:
virtual ~CMakeCommandLineInfo(); virtual ~CMakeCommandLineInfo();
protected:
static int GetBoolValue(const CString&);
}; };
#endif // !defined(CMAKECOMMANDLINEINFO_H) #endif // !defined(CMAKECOMMANDLINEINFO_H)

View File

@ -86,8 +86,8 @@ CMakeSetupDialog::CMakeSetupDialog(const CMakeCommandLineInfo& cmdInfo,
//{{AFX_DATA_INIT(CMakeSetupDialog) //{{AFX_DATA_INIT(CMakeSetupDialog)
m_WhereSource = cmdInfo.m_WhereSource; m_WhereSource = cmdInfo.m_WhereSource;
m_WhereBuild = cmdInfo.m_WhereBuild; m_WhereBuild = cmdInfo.m_WhereBuild;
m_GeneratorChoiceString = _T(""); m_GeneratorChoiceString = cmdInfo.m_GeneratorChoiceString;
m_AdvancedValues = FALSE; m_AdvancedValues = cmdInfo.m_AdvancedValues;
//}}AFX_DATA_INIT //}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32 // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
@ -977,7 +977,8 @@ int CMakeSetupDialog::CreateShortcut()
} }
// Set the arguments of the shortcut. // Set the arguments of the shortcut.
CString args = " /H=" + m_WhereSource + " /B=" + m_WhereBuild; CString args = " /H=\"" + m_WhereSource + "\" /B=\"" + m_WhereBuild + "\" /G=\"" + m_GeneratorChoiceString + "\" /A=\"" + (m_AdvancedValues ? "TRUE" : "FALSE") + "\"";
hres = psl->SetArguments(args); hres = psl->SetArguments(args);
if (! SUCCEEDED (hres)) if (! SUCCEEDED (hres))