cmIDEOptions: Add support for case-insensitive flags

This commit is contained in:
Brad King 2016-01-08 14:30:06 -05:00
parent cedbb7994d
commit 4ca9df8bd1
2 changed files with 9 additions and 2 deletions

View File

@ -32,6 +32,7 @@ struct cmIDEFlagTable
// /NODEFAULTLIB: =>
// IgnoreDefaultLibraryNames)
UserFollowing = (1<<5), // expect value in following argument
CaseInsensitive = (1<<6), // flag may be any case
UserValueIgnored = UserValue | UserIgnored,
UserValueRequired = UserValue | UserRequired

View File

@ -13,6 +13,8 @@
#include "cmSystemTools.h"
#include <cmsys/String.h>
//----------------------------------------------------------------------------
cmIDEOptions::cmIDEOptions()
{
@ -104,7 +106,9 @@ bool cmIDEOptions::CheckFlagTable(cmIDEFlagTable const* table,
// the entry specifies UserRequired we must match only if a
// non-empty value is given.
int n = static_cast<int>(strlen(entry->commandFlag));
if(strncmp(flag+1, entry->commandFlag, n) == 0 &&
if((strncmp(flag+1, entry->commandFlag, n) == 0 ||
(entry->special & cmIDEFlagTable::CaseInsensitive &&
cmsysString_strncasecmp(flag+1, entry->commandFlag, n))) &&
(!(entry->special & cmIDEFlagTable::UserRequired) ||
static_cast<int>(strlen(flag+1)) > n))
{
@ -112,7 +116,9 @@ bool cmIDEOptions::CheckFlagTable(cmIDEFlagTable const* table,
entry_found = true;
}
}
else if(strcmp(flag+1, entry->commandFlag) == 0)
else if(strcmp(flag+1, entry->commandFlag) == 0 ||
(entry->special & cmIDEFlagTable::CaseInsensitive &&
cmsysString_strcasecmp(flag+1, entry->commandFlag) == 0))
{
if(entry->special & cmIDEFlagTable::UserFollowing)
{