CMake自定义命令复制多个文件 [英] CMake Custom Command copy multiple files

查看:118
本文介绍了CMake自定义命令复制多个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 $ {CMAKE_COMMAND} -E复制< from>复制多个文件。 < to> 格式,但是我想知道是否有一种方法可以提供许多文件复制到特定目录。似乎cmake复制一次只允许复制一个文件。当我宁愿提供要复制的文件列表作为第一个参数时,我真的不想重复使用copy命令。

I am attempting to copy multiple files using the ${CMAKE_COMMAND} -E copy <from> <to> format, but I was wondering if there was a way to provide a number of files to copy to a specific directory. It seems the cmake copy only allows for one file to be copied at a time. I really don't want to use the copy command repeatedly when I would rather provide a list of files to copy as the first argument.

我在考虑最简单的解决方案是使用平台相关的 cp命令。虽然这绝对不利于可移植性,但我们的系统可以保证构建在Linux上。一个简单,独立于平台的解决方案会更好。

I'm thinking the easiest solution is to use the platform dependent "cp" command. While this definitely is not good for portability, our system is guaranteed to be built on Linux. A simple, platform independent solution would be better.

推荐答案

可以从CMake 3.5复制多个文件

Copying multiple files is available from CMake 3.5

cmake -E copy <file>... <destination>

cmake -E复制对多个文件的支持

命令行工具模式

这篇关于CMake自定义命令复制多个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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