Hello, there is <PackageName>_ROOT_DIR variable mentioned in the documentation and I’m not sure I understand why should this variable be used if there is already automatic CMake handling done by <PackageName>_ROOT variable.
Is this meant to be <PackageName>_ROOT or should packages actually use the _ROOT_DIR somehow in addition to <PackageName>_ROOT?
Interesting question, I haven’t thought about this before. But the way I read the documentation now actually makes sense to me: Xxx_ROOT_DIR is the result variable that is (should be, for the sake of consistency/convention) set by the FindXxx.cmake module when/if Xxx is found, and Xxx_ROOT is the variable that FindXxx.cmake module will use to get a list of paths/prefixes of potential Xxx whereabouts to know where to look for it.
So, in other words (and with the right “order of use”):
Xxx_ROOT contains the path(s) of where to look for Xxx;
FindXxx.cmake attempts to find Xxx using those paths;
Yes, I’d welcome a clarification to the documentation of Xxx_ROOT_DIR in that manual.
@retif’s explanation of the purpose of each variable is correct. However, in general it is not expected that Xxx_ROOT_DIR is set by a find module. It’s documented as a naming convention for modules that choose to provide such a variable.