我想为我的项目创建两个不同的包.
> DCM(包括RCM特定模块以外的所有模块)
> RCM(特定模块.)
1. DCM:
SRC/C++MakeList.txt
cmake_minimum_required (VERSION 2.8)
add_subdirectory(ecs) # Include all modules
set(CPACK_GENERATOR TGZ)
set(CPACK_PACKAGE_NAME "dcm")
set(CPACK_PACKAGE_VENDOR "AB")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Device Control")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/ReadMe.txt")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt")
set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH})
set(CPACK_PACKAGE_VERSION_BUILD ${BUILD_NUMBER})
set(CPACK_COMPONENTS_ALL DCM RCM )
# Include CPack to introduce the appropriate targets
include(CPack)
2. RCM:
SRC / ECS / MQA / mqa_rcm / CMakeList.txt
set(RCM_SCRIPTS
commit.sh
install.sh
prepare_for_install.sh
system_check.sh
update_init.sh)
INSTALL(FILES ${RCM_SCRIPTS}
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE WORLD_EXECUTE
DESTINATION ${RCM_INSTALL_PREFIX}/install
COMPONENT RCM )
# Create version file
install(FILES "${CMAKE_BINARY_DIR}/version"
DESTINATION ${RCM_INSTALL_PREFIX}
COMPONENT RCM )
试用 :
在Linux虚拟机提示符上.
$make -j4
$make install
$make package
它只创建单个包DCM-1.90.0-Linux.tar.gz.
参考:
CMake Wiki
和
CPack
和
StackOverflow
问题:
我想创建1. DCM-1.90.0-Linux.tar.gz和2. RCM-1.90.0-Linux.tar.gz包.
我用谷歌搜索,但无法找到确切的解决方案.
如果您需要更多信息,请告诉我.
提前谢谢了.
最佳答案 我只需要将CPACK标志设置为ON.
set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
就在此之前
include(CPack)
并运行命令.
make
make install
make package
它创造了两个不同的包.