Support future KPim5Akonadi/KPim5IdentityManagement targets
KF5 prefix is deprecated and will be removed in 23.12.
Also picking another commit from !212 (merged):
Drop unstable branch detection from CMakeLists
This appears to be unnecessary now, so cleanup.
This reverts commit de34484f95b126303b087015359379395b69273b
while keeping minor style changes.