ABSTRACT We investigate the acceleration of cosmic rays at the termination shock that results from the interaction of the collective wind of star clusters with the surrounding interstellar medium. The solution of the transport equation of accelerated particles in the wind-excavated cavity, including energy losses due to CR interactions with neutral gas in the bubble, shows several interesting properties that are discussed in detail. The issue of the maximum energy of the accelerated particles is discussed with special care, because of its implications for the origin of Galactic cosmic rays. Gamma-ray emission is produced in the cavity due to inelastic pp scattering, while accelerated particles are advected downstream of the termination shock and diffuse at the same time. Both the spectrum and the morphology of such emission are discussed, with a comparison of our results with the observations of gamma-ray emission from the Cygnus OB2 region.