Fix windows linkage, also, use SYSTEM_LIBS variable for OS-dependent libraries
disable WIN32 flag for executables, fix previous commit