  It is clearly established that the Sun has an 11-year cycle that is caused by
its internal magnetic field. This cycle is also observed in a sample of M
dwarfs. In the framework of exoplanet detection or atmospheric characterisation
of exoplanets, the activity status of the host star plays a crucial role, and
inactive states are preferable for such studies. This means that it is
important to know the activity cycles of these stars. We study systematic
long-term variability in a sample of 211 M dwarfs observed with CARMENES, the
high-resolution optical and near-infrared spectrograph at Calar Alto
Observatory. In an automatic search using time series of different activity
indicators, we identified 26 stars with linear or quadratic trends or with
potentially cyclic behaviour. Additionally, we performed an independent search
in archival R$^{\prime}_{\rm HK}$ data collected from different instruments
whose time baselines were usually much longer. These data are available for a
subset of 186 of our sample stars. Our search revealed 22 cycle candidates in
the data. We found that the percentage of stars showing long-term variations
drops dramatically to the latest M dwarfs. Moreover, we found that the
pseudo-equivalent width (pEW) of the H$\alpha$ and Ca ii infrared triplet more
often triggers automatic detections of long-term variations than the TiO index,
differential line width, chromatic index, or radial velocity. This is in line
with our comparison of the median relative amplitudes of the different
indicators. For stars that trigger our automatic detection, this leads to the
highest amplitude variation in R$^{\prime}_{\rm HK}$, followed by
pEW(H$\alpha$), pEW(Ca ii IRT), and the TiO index.
