Use more target-centric cmake code

2 jobs for master in 3 minutes and 24 seconds (queued for 1 minute and 9 seconds)
Status Name Job ID Coverage
  Build
passed build_clazy_clang_tidy #106905

00:01:57

passed linux kf5-qt5 qt5.15 #106904

00:01:26

69.0%