问题
I want to create two different package for my project.
- DCM (Includes all the modules except RCM specific module )
- RCM (Specific Module.)
1. DCM : src/CMakeList.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 )
Try Out : On Linux virtual machine prompt.
$make -j4
$make install
$make package
It creates only single package DCM-1.90.0-Linux.tar.gz
.
Reference : CMake Wiki and CPack and StackOverflow
Problem :
I want to create 1. DCM-1.90.0-Linux.tar.gz
and 2. RCM-1.90.0-Linux.tar.gz
package.
I googled but, unable to find exact solution.
Let me know in case of you want more information.
Many Thanks in advance.
回答1:
I just need to set CPACK flag ON.
set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
just before
include(CPack)
And run command.
make
make install
make package
And it creates two different packages.
回答2:
I don't use CPack, so maybe there is a better solution than the following.
For my different installations, I define some variables in CACHE (for example : set(INCLUDE_MODULE_XYZ OFF CACHE BOOL "Include the module xyz")
) defining what I put in my installation. You can change the value of this variable running ccmake.
In your case, you can generate your first package, change de configuration with ccmake, and then generate the second package (if needed).
来源:https://stackoverflow.com/questions/28671524/generate-two-different-package-using-cpack-in-cmake-linux