  Open charm production in proton-proton collisions represents an important
tool to investigate some of the most fundamental aspects of Quantum
Chromodynamics, from the partonic mechanisms of heavy-quark production to the
process of heavy-quark hadronisation. Over the last decade, the measurement of
the production cross sections of charm mesons and baryons in proton-proton (pp)
collisions was at the centre of a wide experimental effort at the Large Hadron
Collider. Thanks to the complementarity of the different experiments, the
production of charm hadrons was measured over a wide transverse momentum region
and in different rapidity ranges. In this paper, the measurements of the charm
hadrons $D^0$, $D^*$, $D^+$, $D_s^+$, $\Lambda_c^+$ and $\Xi_c^0$ performed by
the ALICE, CMS and LHCb collaborations in pp collisions at the centre-of-mass
energy $\sqrt{s}=\rm 5.02~TeV$ are combined to determine the total charm-quark
production cross section $\sigma_{c\overline{c}}$ in a novel data-driven
approach. The resulting total $c\overline{c}$ cross section is
\begin{equation*} \begin{aligned}
  \sigma_\mathrm{c\overline{c}} (\mathrm{pp},5.02\,\mathrm{TeV}) ={} & 8340.9
\pm 217.8\mathrm{ (stat.) }
  {}^{+367.1}_{-367.2} \mathrm{ (syst.) }
  {}^{+362.5}_{-457.5} \mathrm{ (extr.) }
  + 679.9 (\Omega_\mathrm{c})~\mu\mathrm{b}. \end{aligned} \end{equation*} The
measured charm-hadron distributions and corresponding cross sections are
compared with the most recent theoretical calculations.
