将fixup_bundle结果添加到CPack [英] Add fixup_bundle result to CPack

查看:103
本文介绍了将fixup_bundle结果添加到CPack的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将使用 fixup_bundle 找到的其他库添加到CPack?

How to add additional libraries that were found using the fixup_bundle to the CPack?

这是我的CMake安装脚本:

This is my CMake install script:

install(
    TARGETS ${PROJECT_NAME}
    RUNTIME DESTINATION .)

install(
    FILES
        ${PROJECT_SOURCE_DIR}/LICENSE
        ${PROJECT_SOURCE_DIR}/COPYRIGHT
        ${PROJECT_SOURCE_DIR}/CHANGELOG
        ${PROJECT_SOURCE_DIR}/DESCRIPTION
    DESTINATION .)

install(
    CODE
    "
        include(InstallRequiredSystemLibraries)
        include(BundleUtilities)
        fixup_bundle(${CMAKE_INSTALL_PREFIX}/${SERVICE_INSTALL_PREFIX}/test.exe  \"\" \"\")
    "
    DESTINATION .
    COMPONENT Runtime)

install 文件夹中,我可以找到我的EXE文件,文本内容(许可证,版权等)和所有必需的DLL库.

In the install folder I can found my EXE file, text stuff (LICENSE, COPYRIGHT, etc) and all required DLL libraries.

但是,当我执行 package 目标(使用NSIS构建器)时,它仅复制EXE文件和文本内容,而没有其他DLL库.

But when I execute package target (with NSIS builder), it copy only EXE file and text stuff, without additional DLL libraries.

推荐答案

CPack将用正确的变量替换 CMAKE_INSTALL_PREFIX 变量.但是对于此字符串, $ {CMAKE_INSTALL_PREFIX} 应该在CPack执行代码时存在.将 fixup_bundle 的每个参数都包装为字符串就足够了.

CPack will replace CMAKE_INSTALL_PREFIX variable with the correct one. But for this string ${CMAKE_INSTALL_PREFIX} should exist at the time when CPack will execute the code. It is enough to wrap every argument for fixup_bundle as a string.

install(
    CODE
    "
        include(InstallRequiredSystemLibraries)
        include(BundleUtilities)
        fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/${SERVICE_INSTALL_PREFIX}/test.exe\"  \"\" \"\")
    "
    DESTINATION .
    COMPONENT Runtime)

这篇关于将fixup_bundle结果添加到CPack的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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