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:
parent
f2a3dd9d1a
commit
650199e7ca
|
@ -31,6 +31,7 @@ struct cmIDEFlagTable
|
||||||
// old value with semicolons (e.g.
|
// old value with semicolons (e.g.
|
||||||
// /NODEFAULTLIB: =>
|
// /NODEFAULTLIB: =>
|
||||||
// IgnoreDefaultLibraryNames)
|
// IgnoreDefaultLibraryNames)
|
||||||
|
UserFollowing = (1<<5), // expect value in following argument
|
||||||
|
|
||||||
UserValueIgnored = UserValue | UserIgnored,
|
UserValueIgnored = UserValue | UserIgnored,
|
||||||
UserValueRequired = UserValue | UserRequired
|
UserValueRequired = UserValue | UserRequired
|
||||||
|
|
|
@ -19,6 +19,7 @@ cmIDEOptions::cmIDEOptions()
|
||||||
this->DoingDefine = false;
|
this->DoingDefine = false;
|
||||||
this->AllowDefine = true;
|
this->AllowDefine = true;
|
||||||
this->AllowSlash = false;
|
this->AllowSlash = false;
|
||||||
|
this->DoingFollowing = 0;
|
||||||
for(int i=0; i < FlagTableCount; ++i)
|
for(int i=0; i < FlagTableCount; ++i)
|
||||||
{
|
{
|
||||||
this->FlagTable[i] = 0;
|
this->FlagTable[i] = 0;
|
||||||
|
@ -41,6 +42,14 @@ void cmIDEOptions::HandleFlag(const char* flag)
|
||||||
return;
|
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.
|
// Look for known arguments.
|
||||||
if(flag[0] == '-' || (this->AllowSlash && flag[0] == '/'))
|
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)
|
else if(strcmp(flag+1, entry->commandFlag) == 0)
|
||||||
{
|
{
|
||||||
// This flag table entry provides a fixed value.
|
if(entry->special & cmIDEFlagTable::UserFollowing)
|
||||||
this->FlagMap[entry->IDEName] = entry->value;
|
{
|
||||||
|
// 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;
|
entry_found = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,7 @@ protected:
|
||||||
bool DoingDefine;
|
bool DoingDefine;
|
||||||
bool AllowDefine;
|
bool AllowDefine;
|
||||||
bool AllowSlash;
|
bool AllowSlash;
|
||||||
|
cmIDEFlagTable const* DoingFollowing;
|
||||||
enum { FlagTableCount = 16 };
|
enum { FlagTableCount = 16 };
|
||||||
cmIDEFlagTable const* FlagTable[FlagTableCount];
|
cmIDEFlagTable const* FlagTable[FlagTableCount];
|
||||||
void HandleFlag(const char* flag);
|
void HandleFlag(const char* flag);
|
||||||
|
|
Loading…
Reference in New Issue