[CMake] What is the proper way to export targets that will be split into separate binary packages?

Nils Gladitz nilsgladitz at gmail.com
Tue Apr 28 02:56:26 EDT 2015


On 04/28/2015 01:20 AM, Alan W. Irwin wrote:
> On 2015-04-24 12:33-0700 Alan W. Irwin wrote:
>
> This should be a pretty common issue on Linux since it is quite
> typical there that downstream packaging splits up binary results into
> different packages.  Therefore, I assume there is a CMake solution to
> this issue, and I would appreciate those who know that solution to
> speak up.

I'd go with what Alex suggested in his reply.

In effect it is what e.g. Qt5 does (though they don't use cmake to 
generate the exports obviously and they provide additional package 
configuration files which you can omit).

The umbrella configuration file can use the component specification 
given to find_package() to iterate over the required target export files.

There is an example of this here (scroll down to "If COMPONENTS are 
specified when the downstream uses[...]"):

http://www.cmake.org/cmake/help/v3.2/manual/cmake-packages.7.html#creating-packages

Nils


More information about the CMake mailing list