Commit 650199e7 authored by Brad King's avatar Brad King
Browse files

VS: Support mapping flags with values following separately (#14858)

Add a "UserFollowing" special flag table entry indicator to say that a
flag expects a value in a following argument.  Teach cmIDEOptions to
handle such flags.
parent f2a3dd9d
......@@ -31,6 +31,7 @@ struct cmIDEFlagTable
// old value with semicolons (e.g.
// /NODEFAULTLIB: =>
// IgnoreDefaultLibraryNames)
UserFollowing = (1<<5), // expect value in following argument
UserValueIgnored = UserValue | UserIgnored,
UserValueRequired = UserValue | UserRequired
......
......@@ -19,6 +19,7 @@ cmIDEOptions::cmIDEOptions()
this->DoingDefine = false;
this->AllowDefine = true;
this->AllowSlash = false;
this->DoingFollowing = 0;
for(int i=0; i < FlagTableCount; ++i)
{
this->FlagTable[i] = 0;
......@@ -41,6 +42,14 @@ void cmIDEOptions::HandleFlag(const char* flag)
return;
}
// If the last option expected a following value, this is it.
if(this->DoingFollowing)
{
this->FlagMapUpdate(this->DoingFollowing, flag);
this->DoingFollowing = 0;
return;
}
// Look for known arguments.
if(flag[0] == '-' || (this->AllowSlash && flag[0] == '/'))
{
......@@ -105,8 +114,16 @@ bool cmIDEOptions::CheckFlagTable(cmIDEFlagTable const* table,
}
else if(strcmp(flag+1, entry->commandFlag) == 0)
{
// This flag table entry provides a fixed value.
this->FlagMap[entry->IDEName] = entry->value;
if(entry->special & cmIDEFlagTable::UserFollowing)
{
// This flag expects a value in the following argument.
this->DoingFollowing = entry;
}
else
{
// This flag table entry provides a fixed value.
this->FlagMap[entry->IDEName] = entry->value;
}
entry_found = true;
}
......
......@@ -51,6 +51,7 @@ protected:
bool DoingDefine;
bool AllowDefine;
bool AllowSlash;
cmIDEFlagTable const* DoingFollowing;
enum { FlagTableCount = 16 };
cmIDEFlagTable const* FlagTable[FlagTableCount];
void HandleFlag(const char* flag);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment