diff --git a/CHANGES.txt b/CHANGES.txt index cfae7279..13963f82 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -3,6 +3,7 @@ -------- * Completely overhauled the platform support; too many changes to list +* Added remove...() API to remove values from list fields * Added debugformat with C7 support for Visual Studio * The error message for invalid flags now includes the offending value * The include() function will now include each file only once diff --git a/src/project/oven.lua b/src/project/oven.lua index 711e1488..1fb9aff7 100755 --- a/src/project/oven.lua +++ b/src/project/oven.lua @@ -243,13 +243,19 @@ function oven.removefromfield(field, removes) if field and removes then - for index, value in ipairs(field) do - for key, pattern in ipairs(removes) do - if pattern == value then - table.remove(field, index) - break + for key, pattern in ipairs(removes) do + pattern = path.wildcards(pattern):lower() + + local i = 1 + while i <= #field do + local value = field[i]:lower() + if value:match(pattern) == value then + table.remove(field, i) + else + i = i + 1 end end + end end end diff --git a/tests/project/test_baking.lua b/tests/project/test_baking.lua index 1161fb58..d9af1bac 100755 --- a/tests/project/test_baking.lua +++ b/tests/project/test_baking.lua @@ -264,3 +264,15 @@ cfg = oven.bake(sln) test.isequal("Symbols|Optimize", table.concat(cfg.flags, "|")) end + + +-- +-- Remove should also accept wildcards. +-- + + function suite.remove_onWildcard() + defines { "WIN32", "WIN64", "LINUX", "MACOSX" } + removedefines { "WIN*" } + cfg = oven.bake(sln) + test.isequal("LINUX|MACOSX", table.concat(cfg.defines, "|")) + end