Use more target-centric cmake code

2 jobs for master in 3 minutes and 59 seconds (queued for 64 minutes and 30 seconds)
Status Name Job ID Coverage
  Build
passed build_clazy_clang_tidy #106882

00:02:06

passed linux kf5-qt5 qt5.15 #106881

00:01:53

76.0%