Use more target-centric cmake code

2 jobs for master in 5 minutes and 20 seconds (queued for 2 minutes and 55 seconds)
Status Name Job ID Coverage
  Build
passed build_clazy_clang_tidy #106907

00:03:57

passed linux kf5-qt5 qt5.15 #106906

00:01:22

80.0%