Fix type checks in CMake

Use CHECK_TYPE_SIZE to check existence of types.