  We consider shape optimization problems of the form $$\min\big\{J(\Omega)\ :\
\Omega\subset X,\ m(\Omega)\le c\big\},$$ where $X$ is a metric measure space
and $J$ is a suitable shape functional. We adapt the notions of
$\gamma$-convergence and weak $\gamma$-convergence to this new general abstract
setting to prove the existence of an optimal domain. Several examples are
pointed out and discussed.
