Fix building with cmake on cygwin.

Add required libraries for the link stage.