FindPkgConfig

A pkg-config module for CMake.

CMake的pkg-config模块。

Finds the pkg-config executable and add the pkg_check_modules() and pkg_search_module() commands.

查找 pkg-config 执行档并且添加 pkg_check_modules() 和 pkg_search_module() 命令。

In order to find the pkg-config executable, it uses the PKG_CONFIG_EXECUTABLE variable or the PKG_CONFIG environment variable first.

为了找到 pkg-config 执行档,首先使用 PKG_CONFIG_EXECUTABLE 变量或者 PKG_CONFIG 环境变量。

pkg_check_modules

Checks for all the given modules.

检查所有给出的模块。

pkg_check_modules(<PREFIX> [REQUIRED] [QUIET]
[NO_CMAKE_PATH] [NO_CMAKE_ENVIRONMENT_PATH]
<MODULE> [<MODULE>]*)

When the REQUIRED argument was set, macros will fail with an error when module(s) could not be found.

如果设置了 REQUIRED 参数,未找到模块时宏将错误并失败。

When the QUIET argument is set, no status messages will be printed.

如果设置了 QUIET 参数,将不打印状态信息。

By default, if CMAKE_MINIMUM_REQUIRED_VERSION is 3.1 or later, or if PKG_CONFIG_USE_CMAKE_PREFIX_PATH is set, the CMAKE_PREFIX_PATH, CMAKE_FRAMEWORK_PATH, and CMAKE_APPBUNDLE_PATH cache and environment variables will be added to pkg-config search path. The NO_CMAKE_PATH and NO_CMAKE_ENVIRONMENT_PATH arguments disable this behavior for the cache variables and the environment variables, respectively.

默认的,如果 CMAKE_MINIMUM_REQUIRED_VERSION 是3.1或之后的版本,或者设置了 PKG_CONFIG_USE_CMAKE_PREFIX_PATH,如下的缓存和环境变量将被添加到 pkg-config 查找路径:CMAKE_PREFIX_PATH,CMAKE_FRAMEWORK_PATH 和 CMAKE_APPBUNDLE_PATH 。 NO_CMAKE_PATH 和 NO_CMAKE_ENVIRONMENT_PATH 参数分别禁用上述的关于缓存变量和环境变量的行为。

It sets the following variables:

设置了如下的变量:

PKG_CONFIG_FOUND          ... if pkg-config executable was found
PKG_CONFIG_EXECUTABLE ... pathname of the pkg-config program
PKG_CONFIG_VERSION_STRING ... the version of the pkg-config program found
(since CMake 2.8.8)

For the following variables two sets of values exist; first one is the common one and has the given PREFIX. The second set contains flags which are given out when pkg-config was called with the --static option.

存在下列的2个系列值;第一个系列是常用的并且以给出的 PREFIX 开始。第二个系列在当 pkg-config 被调用时带有 --static 选项时,包含给出的符号。

<XPREFIX>_FOUND          ... set to 1 if module(s) exist
<XPREFIX>_LIBRARIES ... only the libraries (w/o the '-l')
<XPREFIX>_LIBRARY_DIRS ... the paths of the libraries (w/o the '-L')
<XPREFIX>_LDFLAGS ... all required linker flags
<XPREFIX>_LDFLAGS_OTHER ... all other linker flags
<XPREFIX>_INCLUDE_DIRS ... the '-I' preprocessor flags (w/o the '-I')
<XPREFIX>_CFLAGS ... all required cflags
<XPREFIX>_CFLAGS_OTHER ... the other compiler flags
<XPREFIX> = <PREFIX>        for common case
<XPREFIX> = <PREFIX>_STATIC for static linking

There are some special variables whose prefix depends on the count of given modules. When there is only one module, <PREFIX> stays unchanged. When there are multiple modules, the prefix will be changed to <PREFIX>_<MODNAME>:

有一些特殊的变量前缀依赖给出的模块数。当仅有一个模块给出时,<PREFIX> 保持不变。当有多个模块时,前缀将变为 <PREFIX>_<MODNAME> :

<XPREFIX>_VERSION    ... version of the module
<XPREFIX>_PREFIX ... prefix-directory of the module
<XPREFIX>_INCLUDEDIR ... include-dir of the module
<XPREFIX>_LIBDIR ... lib-dir of the module
<XPREFIX> = <PREFIX>  when |MODULES| == 1, else
<XPREFIX> = <PREFIX>_<MODNAME>

A <MODULE> parameter can have the following formats:

<MODULE> 参数可以是如下的格式:

{MODNAME}            ... matches any version
{MODNAME}>={VERSION} ... at least version <VERSION> is required
{MODNAME}={VERSION} ... exactly version <VERSION> is required
{MODNAME}<={VERSION} ... modules must not be newer than <VERSION>

Examples

例如

pkg_check_modules (GLIB2   glib-2.0)
pkg_check_modules (GLIB2 glib-2.0>=2.10)

Requires at least version 2.10 of glib2 and defines e.g. GLIB2_VERSION=2.10.3

需要 glib2 的版本至少是2.10并且定义项如 GLIB2_VERSION=2.10.3

pkg_check_modules (FOO     glib-2.0>=2.10 gtk+-2.0)

Requires both glib2 and gtk2, and defines e.g. FOO_glib-2.0_VERSION=2.10.3 and FOO_gtk+-2.0_VERSION=2.8.20

请求 glib2 和 gtk2,并且定义如 FOO_glib-2.0_VERSION=2.10.3 和 FOO_gtk+-2.0_VERSION=2.8.20

pkg_check_modules (XRENDER REQUIRED xrender)

Defines for example:

定义例子:

XRENDER_LIBRARIES=Xrender;X11``
XRENDER_STATIC_LIBRARIES=Xrender;X11;pthread;Xau;Xdmcp

pkg_search_module

Same as pkg_check_modules(), but instead it checks for given modules and uses the first working one.

如同 pkg_check_modules(),但是代替它检查给定的模块并使用第一个工作的。

pkg_search_module(<PREFIX> [REQUIRED] [QUIET]
[NO_CMAKE_PATH] [NO_CMAKE_ENVIRONMENT_PATH]
<MODULE> [<MODULE>]*)

Examples

例如

pkg_search_module (BAR     libxml-2.0 libxml2 libxml>=2)

PKG_CONFIG_EXECUTABLE

Path to the pkg-config executable.

pkg-config 执行档的路径。

PKG_CONFIG_USE_CMAKE_PREFIX_PATH

Whether pkg_check_modules() and pkg_search_module() should add the paths in CMAKE_PREFIX_PATH, CMAKE_FRAMEWORK_PATH, and CMAKE_APPBUNDLE_PATH cache and environment variables to pkg-config search path.

pkg_check_modules() 和 pkg_search_module() 是否应该添加路径到 CMAKE_PREFIX_PATH, CMAKE_FRAMEWORK_PATH 和 CMAKE_APPBUNDLE_PATH 缓存和环境变量到 pkg-config 的搜索路径。

If this variable is not set, this behavior is enabled by default if CMAKE_MINIMUM_REQUIRED_VERSION is 3.1 or later, disabled otherwise.

如果变量没设置,在 CMAKE_MINIMUM_REQUIRED_VERSION 为3.1或以后的版本这个行为缺省是启用的,否则禁用。

FindPkgConfig----CMake的pkg-config模块的更多相关文章

  1. CMake中添加Qt模块的合理方法

    https://www.jianshu.com/p/7eeb6f79a275 转载自这里 用CMake来组织的工程中要用Qt首先要设置.找到Qt相关模块.主要是通过find_package这个CMak ...

  2. SpringCloud创建Config模块

    1.说明 本文详细介绍Spring Cloud创建Config模块的方法, 基于已经创建好的Spring Cloud父工程, 请参考SpringCloud创建项目父工程, 创建Config模块这个子工 ...

  3. logging.config模块---使用配置文件管理logger

    logging配置文件 一.使用到的模块: logging.config 官方文档: https://docs.python.org/3/library/logging.config.html 非官方 ...

  4. Py-re正则模块,log模块,config模块,哈希加密

    9.re正则表达式模块,用于字符串的模糊匹配 元字符: 第一:点为通配符 用.表示匹配除了换行符以外的所有字符 import re res=re.findall('a..x','adsxwassxdd ...

  5. config 模块

    import configparser #配置文件 config = configparser.ConfigParser()config["DEFAULT"] = {'Server ...

  6. package 'orocos-bfl' not found CMake Error at /usr/share/cmake-2.8/Modules/FindPkgConfig.cmake:283 (message):

    #没有数字 sudo apt-get install ros-indigo-bfl

  7. drupal7为admin/config页面添加自己开发的模块

    1.实现显示模块 //admin/config配置页面添加journal块 $items['admin/config/journal'] = array(//注意格式为'admin/config/模块 ...

  8. 5 LAMP配置管理:模块(state、file、pkg、service)、jinja模板、job管理、redis主从

    1. 配置管理:state和file https://docs.saltstack.com/en/latest/topics/states/index.html Full list of states ...

  9. cmake 使用

    1.cmake 显示编译命令: 在顶层CMakeLists.txt里设置 set(CMAKE_VERBOSE_MAKEFILE ON) 或者  cmake .        再           m ...

  10. CMake最好的学习资料

    本文为转载,阅读不友好,请先查看原文:https://blog.gmem.cc/cmake-study-note 收下为原文内容================> 基础知识 CMake简介 CM ...

随机推荐

  1. 安装PIL遇到的问题

    配置:Win7 64位 不过折腾到最后,没有使用PIL,官方的PIL很久木有更新了,换了Pillow,是PIL的衍生吧,一直有更新,但是两者不可在同一环境共存. 1 Python version 2. ...

  2. matlab中gatbx工具箱的添加

    1. 从http://crystalgate.shef.ac.uk/code/下载工具箱压缩包gatbx.zip 2. 解压gatbx.zip,将其子文件夹genetic放在matlab安装目录too ...

  3. PHPCMS v9 实现首页,列表页,内容页调用点击量方法

    大家好,今天有点闲,看很多朋友经常问PHPCMS v9 首页,列表页,内容页调用点击怎么弄,打算抽时间把代码全部归纳出来,以便大家日后使用,如下: 1,首页调用点击量 {pc:content acti ...

  4. linux devel包 和 非devel包的区别

    devel 包主要是供开发用,至少包括以下2个东西: 1. 头文件 2. 链接库 有的还含有开发文档或演示代码. 以 glib 和 glib-devel 为例: 如果你安装基于 glib 开发的程序, ...

  5. 防止多个UIAlertView重叠弹出

    http://www.jianshu.com/p/7ac398ef4532 项目中可能会遇到这种情况,好几个alertView因为逻辑关系全部弹出,用户需要一个个的点击才能将所有的alertView取 ...

  6. Servlet实现文件上传(多文件)(三)

    1.上传文件的页面fileUpload2.jsp <%@ page language="java" import="java.util.*" pageEn ...

  7. hellocharts-android开源图表库(效果非常好)

    泡在网上的日子 发表于 2014-11-07 12:28 第 33156 次阅读 chart 2 编辑推荐:稀土掘金,这是一个高质量的技术干货分享社区,web前端.Android.iOS.设计资源和产 ...

  8. app间互相启动及传参数

    http://blog.sina.com.cn/s/blog_13bc6705b0102wmc5.html http://blog.csdn.net/iefreer/article/details/8 ...

  9. 设计模式笔记之一:MVP架构模式入门(转)

    写在前面:昨天晚上,公司请来专家讲解了下MVP,并要求今后各自负责的模块都要慢慢的转到MVP模式上来.以前由于能力有限,没有认真关注过设计模式.框架什么的,昨晚突然兴趣大发,故这两天空闲时间一直在学习 ...

  10. leetcode--011 copy list with random pointer

    aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAA3UAAABjCAIAAACzC75sAAAMTElEQVR4nO3cyYHivBYG0D8n0nIojo ...