High-finesse optical cavity allows the establishment of long-range interactions between bosons in an optical lattice when most cold atoms experiments are restricted to short-range interactions. Supersolid phases have recently been experimentally observed in such systems. Using both exact quantum Monte Carlo simulations and Gutzwiller approximation, we study the ground state phase diagrams of a two-dimensional Bose-Hubbard model with infinite-range interactions which describes such experiments. In addition to superfluid and insulating Mott phases, the infinite-range checkerboard interactions introduce charge density waves and supersolid phases. We study here the system at various particle densities, elucidate the nature of the phases and quantum phase transitions, and discuss the stability of the phases with respect to phase separation. In particular we confirm the existence and stability of a supersolid phase detected experimentally.