How to use find_package(X CONFIG) results?

How to know how a particular package X responds to find_package(X CONFIG)?
If the package is found then I assume variable X_FOUND is always set. But there doesn’t seem be a “standard” way of setting other result variables. E.g I’ve seen some packages set X_LIBRARIES to an actual library file (e.g. /usr/local/lib/, other packages to an IMPORTED target (e.g. X::Y), and some packages don’t set X_LIBRARIES at all, somehow the IMPORTED target is implied. Some packages set X_VERSION, others do not. Is there no way for my CMakeLists.txt to “know” how to use the find_package(X CONFIG) result, short of me searching for details on the X package website or on a discussion forum?

I think, after find_package you’re going to use it someway. Usually by linking with X::Y.
So, if (TARGET X::Y) will be a good enough sigh, at list, in modern-style cmake.

X_LIBRARIES might not be the case if the package is headers-only
X_FOUND is conveniently set by FindPackageHandleStandardArgs, that is helpful, but nobody strictly demand to use it.

Anyway, if regard FindX.cmake as the special script following the rules, it usually uses FindPackageHandleStandardArgs, and now it is also usually provides imported target. And also it includes kind of comprehensive enough instruction at the top of the module. But if it is just a file which named right way, but with legacy inside - it seems, there is no generally common way to deal with it

@tomoreilly In the contrary, there is a standard for variables defined by a module.

But, after, it is the responsibility of the module’s developer to follow (or not) this standard.

Nope. The docs at the top of the file should help (if present). Otherwise, see the project docs (they should mention this kind of stuff).