4
我有多個CMake項目,每個創建一個debian包。我一直在嘗試創建一個頂級項目,在每個「子項目」上調用add_subdirectory()。所有的子項目都會構建,但「make project」會創建一個包含最後一個子項目規範的項目,幷包含來自所有其他項目的文件。CMake頂級項目與多個子項目創建包
基本上,每個集合(CPACK _...)被下一個項目覆蓋,直到最後一個項目和'install()'調用正在累積。如何在使用頂級項目時分開包創建?
編輯:增加了片段。所有'孩子'項目都是相似的。
# build a CPack driven installer package
if(CMAKE_BUILD_TYPE STREQUAL "release")
set(CPACK_STRIP_FILES TRUE)
endif()
set(CPACK_GENERATOR DEB)
set(CPACK_PACKAGE_NAME ${PROJECT_NAME})
set(CPACK_PACKAGE_VENDOR Acme)
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "acme <[email protected]>")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Acme daemon")
message(STATUS "CPACK_PACKAGE_DESCRIPTION_SUMMARY: " ${CPACK_PACKAGE_DESCRIPTION_SUMMARY})
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
set(SYSTEM_PROCESSOR amd64)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "arm")
set(SYSTEM_PROCESSOR armhf)
else()
message(FATAL_ERROR "CMAKE_SYSTEM_PROCESSOR: " ${CMAKE_SYSTEM_PROCESSOR})
endif()
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE ${SYSTEM_PROCESSOR})
message(STATUS "CPACK_DEBIAN_PACKAGE_ARCHITECTURE: " ${CPACK_DEBIAN_PACKAGE_ARCHITECTURE})
include(InstallRequiredSystemLibraries)
set(CPACK_PACKAGE_VERSION_MAJOR ${${PROJECT_NAME}_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${${PROJECT_NAME}_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${${PROJECT_NAME}_VERSION_PATCH})
set(CPACK_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
set(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CMAKE_SYSTEM_NAME}-${SYSTEM_PROCESSOR})
message(STATUS "CPACK_PACKAGE_FILE_NAME: " ${CPACK_PACKAGE_FILE_NAME})
set(CPACK_DEBIAN_PACKAGE_PRIORITY optional)
include(CPack)
你能分享子目錄CMakeLists的摘錄.txt文件?也就是說,'set(CPACK _...)'實際上是如何發生的? – Antonio 2015-03-26 14:34:43
我剛剛編輯了我的原始文章,並添加了每個'child'項目的CMakeLists.txt包含的片段。 – DKLind 2015-03-26 16:25:45
我認爲這不僅僅是一個CMake問題,這是一個CPack問題(我不知道,對不起)。搜索「cpack多個軟件包」有幾個想法... – Antonio 2015-03-27 12:21:08