consensus lib work: some win build fixes necessary for dll creation

This is a follow-up of #5081. It includes a different fix for the link problem that should be more robust anyway.


- Fix for linking static libs into dll's.
- Split out LIBS for Windows builds as was done for INCLUDES in 6b09940.

This should result in no noticeable changes.
er, that note should say "refuses to link static libs into a dll". Will fix that.