You can't test for the version number before including kcal[endar]core_version.h ... catch 22.
This is going to need a cmake check for which header is available.
Or kcalendarcore could keep installing a kcalcore_version.h file with the same contents as kcalendarcore_version.h?
But then I also wonder if one day kcalendarcore_version.h will define KCALENDARCORE_VERSION rather than KCALCORE_VERSION... sounds like it should do both then...
see https://cgit.kde.org/kcalcore.git/tree/src/CMakeLists.txt#n138 - seems to work here
But that leaves the problem of the version header, we also need to install that with the old name I think.