/home/bill/System_maintenance/cmake/cmake package layout.txt 05Jul2017 11:40 https://cmake.org/cmake/help/git-master/manual/cmake-packages.7.html#package-layout Package Layout A config-file package consists of a Package Configuration File and optionally a Package Version File provided with the project distribution. Package Configuration File Consider a project Foo that installs the following files: /include/foo-1.2/foo.h /lib/foo-1.2/libfoo.a It may also provide a CMake package configuration file: /lib/cmake/foo-1.2/FooConfig.cmake with content defining IMPORTED targets, or defining variables, such as: # ... # (compute PREFIX relative to file location) # ... set(Foo_INCLUDE_DIRS ${PREFIX}/include/foo-1.2) set(Foo_LIBRARIES ${PREFIX}/lib/foo-1.2/libfoo.a) If another project wishes to use Foo it need only to locate the FooConfig.cmake file and load it to get all the information it needs about package content locations. Since the package configuration file is provided by the package installation it already knows all the file locations. The find_package() command may be used to search for the package configuration file. This command constructs a set of installation prefixes and searches under each prefix in several locations. Given the name Foo, it looks for a file called FooConfig.cmake or foo-config.cmake. The full set of locations is specified in the find_package() command documentation. One place it looks is: /lib/cmake/Foo*/ where Foo* is a case-insensitive globbing expression. In our example the globbing expression will match /lib/cmake/foo-1.2 and the package configuration file will be found. Once found, a package configuration file is immediately loaded. It, together with a package version file, contains all the information the project needs to use the package.