Misc CMake adjustments

Fixed GCC CXX detection.
Added more default cflags.