Query available version(s) of package before find_package()

As a suggestion, would it not make sense to simply use fall through logic?

You first write find_package with the most likely, or most desired version (since cmake 3.19 you can use ranges, otherwise you need to do it newest version first).
If the find_package fails, then you provide the next find_package with the support for the older component. And so on.
If your code needs to know then you can define compiler flags inside those if statements as well.

Of course, you can’t put the REQUIRED in the first package calls. But ‘worst case’ you can put a message(FATAL_ERROR “”) at the end if none of the find_packages found something.

The biggest downside I see is that it will be slower for the variations further down list.