CMake: Where to install FooBarConfig.cmake and Foo

2019-06-12 01:07发布

Let be a library A that I compile with CMake. I also want to distribute it via a package (e.g. RPM).

Where should my package install the files AConfig.cmake and AConfigVersion.cmake ?

In /usr/share/cmake/Modules on Linux ?

1条回答
神经病院院长
2楼-- · 2019-06-12 01:35

You should find what you need here:

http://www.cmake.org/Wiki/CMake/Tutorials/Packaging

With the relevant portion of the text:

Consider a project "Foo" that installs the following files:

  • <prefix>/include/foo-1.2/foo.h
  • <prefix>/lib/foo-1.2/libfoo.a

It may also provide a CMake package configuration file

  • <prefix>/lib/foo-1.2/foo-config.cmake

The config files need the be in your install tree. Only the FindXXX.cmake file should go in the modules directory.

查看更多
登录 后发表回答