CMake/Tutorials/Package Registry: Difference between revisions

From KitwarePublic
Jump to navigationJump to search
No edit summary
Line 6: Line 6:
* [[#System|System Package Registry]]
* [[#System|System Package Registry]]


The registries are especially useful to help project find packages in non-standard install locations or directly in their own build trees.
A project may use the <code>export(PACKAGE)</code> command to register its build tree in the ''user'' package registry.
A project may use the <code>export(PACKAGE)</code> command to register its build tree in the ''user'' package registry.
A package installer may populate either the user or system registry (using its own means) to refer to the installed package location.
A package installer may populate either the user or system registry (using its own means) to refer to the installed package location.

Revision as of 20:14, 14 February 2012

Introduction

CMake provides two central locations to register packages that have been built or installed anywhere on a system:

The registries are especially useful to help project find packages in non-standard install locations or directly in their own build trees. A project may use the export(PACKAGE) command to register its build tree in the user package registry. A package installer may populate either the user or system registry (using its own means) to refer to the installed package location. In either case the package should store at the registered location a package configuration file (<package>Config.cmake) and optionally a package version file (<package>ConfigVersion.cmake).

The find_package command searches the package registries as specified in its documentation. If it has sufficient permissions it also removes stale package registry entries that refer to directories that do not exist or do not contain a matching package configuration file.

User

The User Package Registry is stored in a per-user location.

On Windows the user package registry is stored in the Windows registry under a key in HKEY_CURRENT_USER. A <package> may appear under registry key

 HKEY_CURRENT_USER\Software\Kitware\CMake\Packages\<package>

as a REG_SZ value, with arbitrary name, that specifies the directory containing the package configuration file.

On UNIX platforms the user package registry is stored in the user home directory under ~/.cmake/packages. A <package> may appear under the directory

 ~/.cmake/packages/<package>

as a file, with arbitrary name, whose content specifies the directory containing the package configuration file.

System

The System Package Registry is stored in a system-wide location.

On Windows the system package registry is stored in the Windows registry under a key in HKEY_LOCAL_MACHINE. A <package> may appear under registry key

 HKEY_LOCAL_MACHINE\Software\Kitware\CMake\Packages\<package>

as a REG_SZ value, with arbitrary name, that specifies the directory containing the package configuration file.

There is no system package registry on non-Windows platforms.