CMake依赖于“所有”目标从自定义目标

编程入门 行业动态 更新时间:2024-10-06 16:22:36
本文介绍了CMake依赖于“所有”目标从自定义目标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在制作一个需要以高级方式打包的图书馆,作为其中的一部分,我有一个包含这些行的脚本:

I'm making a library that needs to be packaged in a fancy way, and as part of that, I have a script that contains these lines:

#only install the lib component, nd put in the a special directory ADD_CUSTOM_TARGET(o_destdir_install COMMAND DESTDIR=${CMAKE_BINARY_DIR}/o_package ${CMAKE_COMMAND} -DCOMPONENT=lib -P cmake_install.cmake DEPENDS ${CMAKE_BINARY_DIR}/cmake_install.cmake COMMENT "Building o_package directory with DESTDIR" ) ADD_DEPENDENCIES(o_destdir_install all preinstall)

我从旧的UseDebian.cmake dpkg生成器中找到了这个代码,但它不会生成所有和预安装,安装。使我的目标取决于一个非内置的目标似乎工作,但我不能依赖任何内置的目标,它似乎。我如何让这个工作?

I've found this code from the old UseDebian.cmake dpkg builder, however it does NOT build all and preinstall before it runs the install. Making my target depend on a non-built-in target seems to work, but I can't depend on any built-in targets it seems. How can I get this to work?

此外,如果我可以依赖单个组件安装,最好没有黑客调用cmake,但是我可以很好。

Also it would be nice if I could depend on a single component install preferably without the hacking calling of cmake, but I'm fine either way

推荐答案

代替合并自己的安装目标,你应该使用 install(CODE) 表单:

Instead of hacking together your own install target, you should just piggy-back on the existing one using the install(CODE) form:

install(CODE "execute_process(COMMAND DESTDIR=${CMAKE_BINARY_DIR}/o_package ${CMAKE_COMMAND} -DCOMPONENT=lib -P cmake_install.cmake")

更多推荐

CMake依赖于“所有”目标从自定义目标

本文发布于:2023-11-12 21:13:26,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1582539.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:目标   自定义   依赖于   CMake

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!