A search for \CP violation in Cabibbo-suppressed D±→KS0K± and Ds±→KS0π± decays is performed using pp collision data, corresponding to an integrated luminosity of 3~fb−1, recorded by the LHCb experiment. The individual CP-violating asymmetries are measured to be \begin{eqnarray*}
\mathcal{A}_{CP}^{D^{\pm}\rightarrow K^0_{\mathrm{S}} K^{\pm}} & = & (+0.03 \pm 0.17 \pm 0.14) \%
\mathcal{A}_{CP}^{D^{\pm}_{s}\rightarrow K^0_{\mathrm{S}} \pi^{\pm}} & = & (+0.38 \pm 0.46 \pm 0.17) \%, \end{eqnarray*} assuming that CP violation in the Cabibbo-favoured decays is negligible. A combination of the measured asymmetries for the four decay modes D(s)±→KS0K± and D(s)±→KS0π± gives the sum \[
\mathcal{A}_{CP}^{D^{\pm}\rightarrow K^0_{\mathrm{S}} K^{\pm}} + \mathcal{A}_{CP}^{D^{\pm}_{s}\rightarrow K^0_{\mathrm{S}} \pi^{\pm}} = (+0.41 \pm 0.49 \pm 0.26) \%. \] In all cases, the first uncertainties are statistical and the second systematic. The results represent the most precise measurements of these asymmetries to date and show no evidence for CP violation.