Fixing cmake project for win32

The cmakelists that I tested worked on linux but not on win32.
I made small fixes to get it to work on win32 platform.

This probably needs more thorough testing, to make sure nothing is broken on other platforms where it is supposed to work but that I couldnt test on.