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.
This commit is contained in:
Brad King 2014-04-01 14:56:08 -04:00
parent f2a3dd9d1a
commit 650199e7ca
3 changed files with 21 additions and 2 deletions

View File

@ -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

View File

@ -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;
}

View File

@ -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);