[Core/SD2] Make SD2 optional and fix a bug in config.h.cmake