Merge with Premake-dev tip

This commit is contained in:
Jason Perkins 2013-02-25 10:49:00 -05:00
commit 1773146d4d
2 changed files with 20 additions and 13 deletions

View File

@ -106,6 +106,7 @@
* Fix linking to external libraries outside of project folder
* Improve processing of ld.so.conf (Cameron Hart)
* Patch 154: Fix .def file support for VS2010 (Riccardo Ghetta)
* Patch 159: Validate all values passed to options (Moi_ioM)
-------

View File

@ -1,17 +1,17 @@
--
-- option.lua
-- Work with the list of registered options.
-- Copyright (c) 2002-2009 Jason Perkins and the Premake project
-- Copyright (c) 2002-2013 Jason Perkins and the Premake project
--
premake.option = { }
premake.option = {}
--
-- The list of registered options.
--
premake.option.list = { }
premake.option.list = {}
--
@ -96,11 +96,17 @@
end
-- is the value allowed?
if (opt.allowed) then
if opt.allowed then
local found = false
for _, match in ipairs(opt.allowed) do
if (match[1] == value) then return true end
if match[1] == value then
found = true
break
end
end
if not found then
return false, string.format("invalid value '%s' for option '%s'", value, key)
end
return false, "invalid value '" .. value .. "' for option '" .. key .. "'"
end
end
return true