Cpack不会复制BundleUtilities文件

时间:2019-12-13 07:43:27

标签: c++ cmake cpack

我是cmake的新手,所以这或多或少是一个愚蠢的问题。 我正在创建一个依赖curl,Qt和ffmpeg的多平台应用程序。 我想动态链接它们。

在Windows上,需要包括* .dll文件。我试图在安装时为此目的使用fixup_bundle()。 这就像一个魅力。所以没问题。

当我想打包应用程序时,问题就开始了。为此,我正在使用WIX和7ZIP。 都没有创建* .dll。

我不确定问题出在哪里。 这是我的代码:

set(RELATIV_INSTALL_DIRECTORY "bin")
install(TARGETS ${CMAKE_PROJECT_NAME} 
    DESTINATION ${RELATIV_INSTALL_DIRECTORY}
    COMPONENT app)

# DIRS contains all directories the *dll files are located
set(executable_path "\${CMAKE_INSTALL_PREFIX}/${RELATIV_INSTALL_DIRECTORY}/${CMAKE_PROJECT_NAME}.exe")

install(CODE "
    include (BundleUtilities)
    fixup_bundle(\"${executable_path}\" \"\" \"${DIRS}\")
    "
    COMPONENT app)

set(CPACK_OUTPUT_FILE_PREFIX "${CMAKE_BINARY_DIR}/package")
set(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}")
set(CPACK_PACKAGE_VENDOR "${COMPANY_NAME}")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Installer for ${CMAKE_PROJECT_NAME}.")
set(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}")
set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "company/${CMAKE_PROJECT_NAME}")
set(CPACK_COMPONENTS_ALL app)
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/license.txt")

if(WIN32)
    set(CPACK_WIX_UI_DIALOG "${CMAKE_CURRENT_SOURCE_DIR}/res/windows/welcome.bmp")
    # set(CPACK_WIX_PRODUCT_ICON "${CMAKE_CURRENT_SOURCE_DIR}/res/windows/Logo.ico")
    set(CPACK_WIX_UI_BANNER "${CMAKE_CURRENT_SOURCE_DIR}/res/windows/header.bmp")
    set(CPACK_GENERATOR WIX;7Z)
endif()
include(CPack)

我不确定为什么它不会在生成的安装程序中显示。

最好的问候, 塞巴斯蒂安

0 个答案:

没有答案