Fix compilation on windows
Better support for crosscompiling with CMake. This might still need some more work