Windows and Linux CMake fixes

Alot of fixes, hope they all work on many enviroment!