CMake命令之export

export

Export targets from the build tree for use by outside projects.

export(EXPORT <export-name> [NAMESPACE <namespace>] [FILE <filename>])

Create a file <filename> that may be included by outside projects to import targets from the current project’s build tree.This is useful during cross-compiling to build utility executables that can run on the host platform in one project and then import them into another project being compiled for the target platform. If the NAMESPACE option is given the <namespace> string will be prepended to all target names written to the file.

Target installations are associated with the export <export-name> using the EXPORT option of the install(TARGETS) command.

The file created by this command is specific to the build tree and should never be installed. See the install(EXPORT) command to export targets from an installation tree.

The properties set on the generated IMPORTED targets will have the same values as the final values of the input TARGETS.

export(TARGETS [target1 [target2 [...]]] [NAMESPACE <namespace>]
       [APPEND] FILE <filename> [EXPORT_LINK_INTERFACE_LIBRARIES])

This signature is similar to the EXPORT signature, but targets are listed explicitly rather than specified as an export-name. If the APPEND option is given the generated code will be appended to the file instead of overwriting it. The EXPORT_LINK_INTERFACE_LIBRARIES keyword, if present, causes the contents of the properties matching (IMPORTED_)?LINK_INTERFACE_LIBRARIES(_<CONFIG>)? to be exported, when policy CMP0022 is NEW. If a library target is included in the export but a target to which it links is not included the behavior is unspecified.

export(PACKAGE <name>)

Store the current build directory in the CMake user package registry for package <name>. The find_package command may consider the directory while searching for package <name>. This helps dependent projects find and use a package from the current project’s build tree without help from the user. Note that the entry in the package registry that this command creates works only in conjunction with a package configuration file (<name>Config.cmake) that works with the build tree. In some cases, for example for packaging and for system wide installations, it is not desirable to write the user package registry. If the CMAKE_EXPORT_NO_PACKAGE_REGISTRY variable is enabled, the export(PACKAGE) command will do nothing.

原文地址:https://www.cnblogs.com/liuzhenbo/p/11186613.html

时间: 2024-11-13 09:43:34

CMake命令之export的相关文章

CMake命令:CMake构建系统的骨架

CMake命令:CMake构建系统的骨架 80个命令(转载自http://www.cnblogs.com/coderfenghc/archive/2012/06/16/CMake_ch_01.html#2996205) CMD#1: add_custom_command为生成的构建系统添加一条自定义的构建规则. add_custom_command命令有两种主要的功能:第一种是为了生成输出文件,添加一条自定义命令. add_custom_command(OUTPUT output1 [outpu

Zsh安装CMake补全脚本进行CMake命令补全

最近在尝试使用Zsh,发现其补全命令的功能相当厉害.但对CMake命令的补全在默认的5.0.5中好像没有看到,网上找了下关于配置Zsh补全的文章也没有多少.     于是自己动手,发现在Zsh安装目录下有个functions的文件夹,里面都有以_开头的各种补全提示文件,比如_sed,_awk等,于是尝试在网上 下到zsh_cmake补全文件之后,重命名为_cmake放置该文件夹中(注意Windows用户的换行符,在这个上浪费了很多时间,使用 dos2unix可以解决)重新启动Zsh,享受CMak

mysql配置文件夹错误:在安装mysql 5.6.19 时运行cmake命令是出现CMake Error: The source directory does not appear to contai

在安装mysql 5.5.xx 时运行cmake命令是出现CMake Error: The source directory does not appear to contain CMakeLists.txt.的错误,刚開始以为是cmake版本号有问题,到最后才发现是当前文件夹错了. 在运行cmake时没有切换到mysql的源代码文件夹导致了这个错误,切换到mysql的源代码文件夹又一次运行cmake命令就可以. 下面的命令在解压后的文件夹内运行下面命令: cmake \ -DCMAKE_INS

mysql配置目录错误:在安装mysql 5.6.19 时执行cmake命令是出现CMake Error: The source directory does not appear to contai

在安装mysql 5.5.xx 时执行cmake命令是出现CMake Error: The source directory does not appear to contain CMakeLists.txt.的错误,刚开始以为是cmake版本有问题,到最后才发现是当前目录错了. 在执行cmake时没有切换到mysql的源码目录导致了这个错误,切换到mysql的源码目录重新执行cmake命令即可. 以下的命令在解压后的目录内执行以下命令: cmake \ -DCMAKE_INSTALL_PREF

CMake命令之list

用途:提供一些列表操作 list(LENGTH <list><output variable>)  list(GET <list> <elementindex> [<element index> ...]       <output variable>)  list(APPEND <list><element> [<element> ...])  list(FIND <list> <

CMake 命令行设定编译环境

笔者电脑安装了两个版本的VS(VS2012  和 VS2010),在使用CMake编译的时候,如果只在对应目录的命令行输入 "cmake .." 则系统会自动选择使用新版本(VS2012)进行编译,如果在一些场合一定要用VS2010编译,可以使用CMake 在Windows 平台上的GUI进行设置,更简便的方法是在命令行中设置参数. 设置方法如下: CMake一般过程是:在含有CMakeLists.txt 文件的目录下,打开命令行窗口,mkdir bin 建立子文件夹,cd bin 进

CMake 命令

1.Usage cmake [options] <path-to-source> cmake [options] <path-to-existing-build> Specify a source directory to (re-)generate a build system for it in the current working directory. Specify an existing build directory to re-generate its build

Linux export 命令

Linux export 命令 功能说明: 设置或显示环境变量.(比如我们要用一个命令,但这个命令的执行文件不在当前目录,这样我们每次用的时候必须指定执行文件的目录,麻烦,在代码中先执行export,这个相当于告诉程序,执行某某东西时,需要的文件或什么东东在这些目录里) 语 法: export [-fnp][变量名称]=[变量设置值] 补充说明: 在shell中执行程序时,shell会提供一组环境变量. export可新增,修改或删除环境变量,供后续执行的程序使用.export的效力仅及于该此登

Linux 命令详解(一)export 命令

一.Windows 环境变量 1.在Windows 系统下,很多软件安装都需要配置环境变量,比如 安装 jdk ,如果不配置环境变量,在非软件安装的目录下运行javac 命令,将会报告找不到文件,类似的错误. 2.那么什么是环境变量?简单说,就是指定一个目录,运行软件的时候,相关的程序将会按照该目录寻找相关文件. 设置变量对于一般人最实用的功能就是: 不用拷贝某些dll文件到系统目录中了,而path 这一系统变量就是系统搜索dll文件的一系列路径 3.在Linux系统下,如果你下载并安装应用程序