In fact, when copying the FindXXX.cmake file to $ {CMAKE_ROOT} / Modules will work, there are several other places where your project can place the "project configuration file" instead of where CMake will find it automatically without the FindXXX.cmake file.
According to the find_package documentation, you can install the project configuration file in your own installation tree, and CMake will find it if your installation tree is in one of the “normal” locations.
Find the text on this page that begins with “CMake creates a set of possible installation prefixes for the package” to find out more about where you can install the project configuration file so that CMake detects it automatically.
source share