From 650199e7ca5821c160e5124e79aaf81141a7918f Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 1 Apr 2014 14:56:08 -0400 Subject: 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. --- Source/cmIDEFlagTable.h | 1 + Source/cmIDEOptions.cxx | 21 +++++++++++++++++++-- Source/cmIDEOptions.h | 1 + 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Source/cmIDEFlagTable.h b/Source/cmIDEFlagTable.h index e372c0a..d9a045d 100644 --- a/Source/cmIDEFlagTable.h +++ b/Source/cmIDEFlagTable.h @@ -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 diff --git a/Source/cmIDEOptions.cxx b/Source/cmIDEOptions.cxx index eda1ef6..1f3c066 100644 --- a/Source/cmIDEOptions.cxx +++ b/Source/cmIDEOptions.cxx @@ -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; } diff --git a/Source/cmIDEOptions.h b/Source/cmIDEOptions.h index 82c1a25..e7749ec 100644 --- a/Source/cmIDEOptions.h +++ b/Source/cmIDEOptions.h @@ -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); -- cgit v0.12