如何将使用fixup_bundle
找到的其他库添加到CPack?
这是我的CMake安装脚本:
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库。
但是,当我执行package
目标(使用NSIS构建器)时,它仅复制EXE文件和文本内容,而没有其他DLL库。
答案 0 :(得分:0)
CPack将CMAKE_INSTALL_PREFIX
变量替换为正确的变量。但是对于此字符串${CMAKE_INSTALL_PREFIX}
应该在CPack执行代码时存在。将fixup_bundle
的每个参数包装为字符串就足够了。
install(
CODE
"
include(InstallRequiredSystemLibraries)
include(BundleUtilities)
fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/${SERVICE_INSTALL_PREFIX}/test.exe\" \"\" \"\")
"
DESTINATION .
COMPONENT Runtime)