the responsibility for package modules and packages with configuration details are basically the same. Professional CMake has an additional chapter which describes the use of config files for Non-CMake projects. Doesn’t this replace package modules completely? When do we need to use package modules instead of packages with configuration details?
There are usually far too many details involved. About the only time that we can reliably generate it automatically (at least with the information CMake knows about today) is in dependency-less, single-component projects. There are very few of those around.
As for the use of each, projects using CMake should use
-config.cmake files to be found by other CMake projects. Projects not using CMake (e.g., Boost or Qt5) can still provide these files, but they must be generated manually. For everything else, generally a
FindFoo.cmake module is made and shipped either in CMake (if already present) or by the project needing it.
So, for projects that are not sufficiently CMake aware using one or another mainly depends on how packages are distributed. Qt is a good example for this since Qt3 and Qt4 are package modules and Qt5 uses packages with configuration details.
-config.cmake files are usually only applicable to the project themselves since they just contain answers rather than doing
find_X commands to look for answers.