7

I want to create two different package for my project.

  1. DCM (Includes all the modules except RCM specific module )
  2. 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.

Community
  • 1
  • 1
AB Bolim
  • 1,997
  • 2
  • 23
  • 47

2 Answers2

3

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.

Mark Lakata
  • 19,989
  • 5
  • 106
  • 123
AB Bolim
  • 1,997
  • 2
  • 23
  • 47
  • But, still its not create package name as expected. package name is something like, name set in CPACK variable `set(CPACK_PACKAGE_FILE_NAME DCM-1.90.0)` then package is created with name 1.`DCM-1.90.0-Linux.tar.gz` and 2.`DCM-1.90.0-.tar.gz` – AB Bolim Feb 26 '15 at 05:45
0

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).

Caduchon
  • 4,574
  • 4
  • 26
  • 67
  • I want to generate both the package using same configuration file. As I cant change configuration file for individual package. – AB Bolim Feb 23 '15 at 13:02