Hey, quick question.
If given a path to a folder of libraries, what would be the best way to link all of them? Is there a premake command that already does this, or will I have to do some directory manipulation in lua? The reason I'm asking this is because it's annoying to write links(lib1,lib2,...,libn) when they are all in the same directory to begin with.

Hi,
You can try to use pattern (e.g.,
links "mydir/*.lib"), or use os.matchfiles if it doesn't work (e.g.,links(os.matchfiles("mydir/*.lib")))Thanks a lot, this mostly works (using your second approach). My issue now is premake attaches .lib to the files automatically, meaning all my links now say: "thing1.lib.lib, thing2.lib.lib, etc" inside visual studio. Is there a way to easily fix this in the script file?
In my opinion, it's a bug. Feel free to add it into tracker.
Possible workaround (untested):
I agree, Premake should be smart enough to detect the existing extension. You can file a bug here.
Filed a bug. Also, your script worked well annulen. The only thing I had to change was this line:
libs[i] = string.gsub(libs[i],".lib$", "")
My bad, gsub does not modify string. This code will work as well:
@starkos ref bug. This seems the defined behaviour:
"When linking against system libraries, do not include any prefix or file extension. Premake will use the appropriate naming conventions for the current platform."
http://industriousone.com/links-0
I see the latest commits[1] add this functionality yet the previous behaviour and the current do not take all possibilities into consideration, this being that foo.bar or just foo are perfectly valid names for libraries. Premake could maybe follow the windows function LoadLibrary behaviour [2], this being if the name has a suffix of "." the default extension is not added. Or it could maybe be documented that the behaviour is to add it and in this instance you need to use possibly linkoptions.
[1] https://bitbucket.org/premake/premake-dev/changeset/484dda4362eb/
[2] http://msdn.microsoft.com/en-us/library/windows/desktop/ms684175(v=vs.85).aspx