Gamma-ray probe of cosmic ray pressure in galaxy clusters and cosmological implications