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.
-no-undefined has to be there anyway to build a dll.

I could go on a long tirade about this one, it goes several layers deep. Yes, it's a hack, but we're insulated from its down-sides due to the constraints we already enforce.