cmake:安装程序时运行程序
我需要在执行A时运行sed
(或等效)命令
install(FILES t/a/a.h t/b/b.h ... DESTINATION include/t)
,以过滤#include< t/a/a/ah>
- > #include< t/ah>
。
我应该如何在cmakelists.txt中指定相关命令?
我需要的原因是,我有一个外部维护的库,我需要在代码中导入。
该库(实际上是 ccan 如果很重要的话)的结构如下:
ccan
├── block_pool
│ ├── block_pool.c
│ ├── block_pool.h
│ ├── _info
│ ├── LICENSE -> ../../licenses/BSD-MIT
│ └── test
│ └── run.c
├── build_assert
│ ├── build_assert.h
│ ├── _info
│ ├── LICENSE -> ../../licenses/CC0
...
├── check_type
│ ├── check_type.h
...
├── CMakeLists.txt
├── compiler
│ ├── compiler.h
...
├── container_of
...
每个ccan> ccan /xxx/xxx.h
可能具有类似的构造:
...
#include <stdbool.h>
#include <assert.h>
#include <ccan/str/str.h>
#include <ccan/container_of/container_of.h>
#include <ccan/check_type/check_type.h>
...
我想将dir树“压缩”到更简单的:
#include <ccan/str.h>
#include <ccan/container_of.h>
#include <ccan/check_type.h>
另外,如果以上太复杂,那么正确的咒语是什么 复制包含目录为IS?我应该添加install(files ...)
每个文件?
I need to run a sed
(or equivalent) command while performing a
install(FILES t/a/a.h t/b/b.h ... DESTINATION include/t)
in order to filter #include <t/a/a.h>
-> #include <t/a.h>
.
How should I specify the relevant command in CMakeLists.txt?
Reason why I need this is I have an externally maintained library I need to import in my code.
This library (actually a piece of ccan, if it matters) is structured like:
ccan
├── block_pool
│ ├── block_pool.c
│ ├── block_pool.h
│ ├── _info
│ ├── LICENSE -> ../../licenses/BSD-MIT
│ └── test
│ └── run.c
├── build_assert
│ ├── build_assert.h
│ ├── _info
│ ├── LICENSE -> ../../licenses/CC0
...
├── check_type
│ ├── check_type.h
...
├── CMakeLists.txt
├── compiler
│ ├── compiler.h
...
├── container_of
...
each ccan/xxx/xxx.h
may have constructs like:
...
#include <stdbool.h>
#include <assert.h>
#include <ccan/str/str.h>
#include <ccan/container_of/container_of.h>
#include <ccan/check_type/check_type.h>
...
and I would like to "compress" the dir tree to a simpler:
#include <ccan/str.h>
#include <ccan/container_of.h>
#include <ccan/check_type.h>
Alternatively, if the above is too complex, what is the right spell
to copy the include directory as-is? Should I add an install(FILES...)
for each file?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论