如何在CMAKE中导出带有组件的库? [英] How to export libraries with components in CMAKE?

查看:101
本文介绍了如何在CMAKE中导出带有组件的库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在CMAKE官方Wiki上查找此信息,并进行搜索(当前正在等待Boost的下载,以便我可以仔细研究源代码,以了解他们的操作方式).我希望这里的某人能够为您提供帮助,或者为我指出正确的答案!

I have tried finding this information on the official CMAKE wiki as well as searching SO (currently waiting for boost to download so I can wade through the source looking for how they do it). I was hoping someone here may be able to help with how this is done, or point me in the right direction to the answers!

我有一个包含多个组件的项目.现在,该项目具有库和应用程序的子目录.我正在尝试重构项目,并在单独的存储库中拥有应用程序,并导出了库.

I have a project that has several components. Right now, the project has subdirectories for libraries, and for applications. I am attempting to refactor the project and have applications in individual repositories and have the libraries exported.

其他项目如何使使用以下命令成为可能(特别是指定哪些组件):

How do other projects make it possible to use the following command (specifically, specifying which components):

FIND_PACKAGE(Boost必需组件系统date_time文件系统)

FIND_PACKAGE (Boost REQUIRED COMPONENTS system date_time filesystem)

我想为自己的项目使用相同的系统:

I would like to use the same system for my own project:

FIND_PACKAGE(项目所需的组件视图gui执行分析)

FIND_PACKAGE (Project REQUIRED COMPONENTS view gui execution analysis)

我们将不胜感激.

推荐答案

一个很好的指南,介绍如何编写在/usr/share/cmake/Modules/readme.txt(或cmake源代码,如果发行版不包含该文件)中发现的查找器.特别是它解释了如何使用find_package_handle_standard_args

a good guide how to write finders you may found in /usr/share/cmake/Modules/readme.txt (or in cmake sources, if your distro do not include that file). particularly it explains how to write a correct module w/ supporting "standard" syntax (REQUIRE, COMPONENTS & etc) using find_package_handle_standard_args

这篇关于如何在CMAKE中导出带有组件的库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆