My preference is to use the package name casing for everything and to provide targets rather than variables like _LIBRARIES or _INCLUDE_DIRS. A lot of CMake modules use various patterns or are trying to match what upstream packages now do; I don’t think they’re a good sampling of good practices unless it’s a brand new module that has no considerations for backwards compat.
OK, even if you use targets, you still might need variables for additional information like version numbers or for backwards compatibility.
There should be a recommend template for Find* modules, with a proper style guide.
That way, at least new modules will be consistent and old modules can slowly be updated to fit the style.
Yeah, this would be good to have. I think there’s an issue tracking CMake making better config.cmake files somewhere. Those guidelines are basically what you’re looking for here.
If you want examples of more complicated projects, take a look at VTK, ParaView, or SMTK (those are ones I worked on at least). VTK and ParaView have some backwards compat bits in there, but the overall structure has what you’re looking for.
CMake itself has a high bar for new Find modules. It is far better for projects to ship their own package-config.cmake file than a Find modules. However, the guidelines are largely the same. Old modules do get updated, but it’s usually as someone notices that they don’t provide imported targets. Variables are almost never renamed due to backwards compatibility guarantees.
Many of the existing modules are very old. Those that don’t follow the conventions are unlikely to be updated. The existing names would have to be kept to preserve backward compatibility. Other variables could be added to match the standard names where this didn’t conflict with the existing variables, but there’s probably not a lot of motivation to do that work.