安装目标依赖项
CMake install target dependencies
我正在编写一个包含库本身和示例的库,我正在使用CMake:
cmake_minimum_required(VERSION 3.6)
add_executable (example main.cpp)
install(DIRECTORY include DESTINATION include PATTERN ".DS_Store" EXCLUDE)
当我运行cmake --build . --target install
-时,它编译example
目标并安装include
目录
我想排除构建example
目标,并且在构建install
目标和构建example
时仅安装include
目录,如果没有任何特殊目标运行:
这里我想要example
是NOT build:cmake --build . --target install
这里我想让example
是 build :cmake --build .
我应该如何改变我的CMakeLists.txt,使其工作,因为我想?
安装时不能排除单个 CMake目标
问题是'install'目标可能只依赖于'all' (default)目标。
虽然你可以删除'install' -> 'all'依赖(通过设置CMAKE_SKIP_INSTALL_ALL_DEPENDENCY变量),但你不能为'install'添加另一个依赖。所以,在安装
之前cmake --build . --target install
要么执行
cmake --build .
或不构建任何(即使是库,你想在任何情况下构建)。
相关文章:
- 如何在 CMake 中对目标依赖项进行分组?
- CMake "安装" 目标及其 SO 依赖项
- 跨目标传播库依赖项
- 如何为在 x86 主机上为 arm 目标交叉编译的项目安装依赖项
- 执行CMAKE目标的输出作为另一个目标的依赖
- 使用 CMake 外部项目为跨平台库依赖项的目标名称
- 模型依赖关系目标,在运行时链接
- 在不同于依赖DLL的文件夹中输出已编译目标的正确方法是什么
- 同一生成文件中的 make 目标之间的递归依赖关系
- 如何为依赖项目标添加 cmake 定义
- 如何只构建一个依赖项目标
- 无法开始,因为cygwin1.dll缺少.目标不是依赖关系
- CMAKE:目标依赖项存在问题(add_dependency不起作用?
- 为什么在构建依赖库之前没有开始编译目标可执行文件?
- 如何在不放置任何物理依赖项的情况下指定生成文件目标生成顺序
- 使目标和依赖项名称格式化
- CMake:如何指定"install"所依赖的目标?
- CMake如何确定目标依赖项的回退生成配置
- 安装目标依赖项
- (make/g++)包含自动生成的依赖目标的完整路径?(或方法)