summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/MFCDialog/CMakeCommandLineInfo.cpp24
-rw-r--r--Source/MFCDialog/CMakeCommandLineInfo.h11
2 files changed, 34 insertions, 1 deletions
diff --git a/Source/MFCDialog/CMakeCommandLineInfo.cpp b/Source/MFCDialog/CMakeCommandLineInfo.cpp
index f48de98..b5e7203 100644
--- a/Source/MFCDialog/CMakeCommandLineInfo.cpp
+++ b/Source/MFCDialog/CMakeCommandLineInfo.cpp
@@ -20,6 +20,11 @@ CMakeCommandLineInfo::CMakeCommandLineInfo()
this->m_AdvancedValues = FALSE;
this->m_GeneratorChoiceString = _T("");
this->m_LastUnknownParameter = _T("");
+
+ // Find the path to the CMakeSetup executable.
+ char fname[4096];
+ ::GetModuleFileName(0, fname, 4096);
+ m_Argv0 = fname;
}
CMakeCommandLineInfo::~CMakeCommandLineInfo()
@@ -51,6 +56,25 @@ int CMakeCommandLineInfo::GetBoolValue(const CString& v) {
void CMakeCommandLineInfo::ParseParam(LPCTSTR lpszParam, BOOL bFlag, BOOL bLast)
{
+ // Construct the full name of the argument.
+ cmStdString value;
+ if(bFlag)
+ {
+ value = "-";
+ }
+ value += lpszParam;
+
+ // Add the argument and reset the argv table in case strings were
+ // moved.
+ m_Arguments.push_back(value);
+ m_Argv.clear();
+ m_Argv.push_back(m_Argv0.c_str());
+ for(unsigned int i=0; i < m_Arguments.size(); ++i)
+ {
+ m_Argv.push_back(m_Arguments[i].c_str());
+ }
+
+ // Look for known flags.
if(!bFlag)
{
this->m_LastUnknownParameter = lpszParam;
diff --git a/Source/MFCDialog/CMakeCommandLineInfo.h b/Source/MFCDialog/CMakeCommandLineInfo.h
index 25b3832..4dee8eb 100644
--- a/Source/MFCDialog/CMakeCommandLineInfo.h
+++ b/Source/MFCDialog/CMakeCommandLineInfo.h
@@ -28,6 +28,8 @@
#error include 'stdafx.h' before including this file for PCH
#endif
+#include "../cmStandardIncludes.h"
+
///////////////////////////////////////////////////////////////
// CMakeCommandLineInfo:
// See CMakeCommandLineInfo.cpp for the implementation of this class
@@ -46,7 +48,14 @@ public:
BOOL m_AdvancedValues;
CString m_GeneratorChoiceString;
CString m_LastUnknownParameter;
-
+
+ int GetArgC() { return static_cast<int>(m_Argv.size()); }
+ const char*const* GetArgV() { return &*m_Argv.begin(); }
+
+ std::string m_Argv0;
+ std::vector<cmStdString> m_Arguments;
+ std::vector<const char*> m_Argv;
+
// Operations
public:
void ParseParam(const TCHAR* pszParam, BOOL bFlag, BOOL bLast);