[CMake] Cpack components' archive names

Tomasz Długosz TDlugosz at advaoptical.com
Mon Oct 12 11:05:14 EDT 2015


Hi All,

I'm struggling to set custom names for cpack's components' archive names.
I call cpack_add_component():

  foreach(COMPONENT_NAME ${CPACK_COMPONENTS_ALL})
    if (CMAKE_BUILD_TYPE STREQUAL "Debug")
      cpack_add_component(${COMPONENT_NAME} ARCHIVE_FILE ${PROJECT_NAME}-${COMPONENT_NAME}-${TOOLCHAIN_PREFIX}-debug-${CPACK_PACKAGE_VERSION})
    else()
      cpack_add_component(${COMPONENT_NAME} ARCHIVE_FILE ${PROJECT_NAME}-${COMPONENT_NAME}-${TOOLCHAIN_PREFIX}-${CPACK_PACKAGE_VERSION})
    endif()
    message(" ----------------------- ${PROJECT_NAME}-${COMPONENT_NAME}-${TOOLCHAIN_PREFIX}-${CPACK_PACKAGE_VERSION}")
  endforeach()

This is the output of cmake:

jenkins-slave at moo:~/workspace/platform/build$ docker run --rm -i -v  /home/jenkins-slave/workspace/platform:/src -w /src/build -u 1007:1007 artifacts.aos-cloud.com:444/ede-prod-vm64 cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=/etc/ede/cmake/Modules/vm64.toolchain.cmake -DBUILD_NG=y -DCMAKE_INSTALL_PREFIX=Install ..
/src/build/Install
-- Boost version: 1.55.0
-- Found the following Boost libraries:
--   filesystem
--   program_options
--   serialization
--   system
INCLUDE: /src/include
----------------------- platform-api-x86_64-vm-linux-gnu-0.0.1.0
----------------------- platform-config-x86_64-vm-linux-gnu-0.0.1.0
----------------------- platform-doc-x86_64-vm-linux-gnu-0.0.1.0
----------------------- platform-example-x86_64-vm-linux-gnu-0.0.1.0
----------------------- platform-runtime-x86_64-vm-linux-gnu-0.0.1.0
-- Configuring done
-- Generating done
-- Build files have been written to: /src/build

The variables are being set: 
jenkins-slave at moo:~/workspace/platform/build$ tail CPackConfig.cmake 
set(CPACK_COMPONENT_CONFIG_ARCHIVE_FILE "platform-config-x86_64-vm-linux-gnu-0.0.1.0")

# Configuration for component "doc"
set(CPACK_COMPONENT_DOC_ARCHIVE_FILE "platform-doc-x86_64-vm-linux-gnu-0.0.1.0")

# Configuration for component "example"
set(CPACK_COMPONENT_EXAMPLE_ARCHIVE_FILE "platform-example-x86_64-vm-linux-gnu-0.0.1.0")

# Configuration for component "runtime"
set(CPACK_COMPONENT_RUNTIME_ARCHIVE_FILE "platform-runtime-x86_64-vm-linux-gnu-0.0.1.0")

But in the end, I still get the wrong file names:

jenkins-slave at moo:~/workspace/platform/build$ docker run --rm -i -v  /home/jenkins-slave/workspace/platform:/src -w /src/build -u 1007:1007 artifacts.aos-cloud.com:444/ede-prod-vm64 cpack
CPack: Create package using TBZ2
CPack: Install projects
CPack: - Run preinstall target for: platform
CPack: - Install project: platform
CPack: -   Install component: api
CPack: -   Install component: config
CPack: -   Install component: doc
CPack: -   Install component: example
CPack: -   Install component: runtime
CPack: Create package
CPack: - package: /src/build/platform-0.0.1.0-Linux-api.tar.bz2 generated.
CPack: - package: /src/build/platform-0.0.1.0-Linux-config.tar.bz2 generated.
CPack: - package: /src/build/platform-0.0.1.0-Linux-doc.tar.bz2 generated.
CPack: - package: /src/build/platform-0.0.1.0-Linux-example.tar.bz2 generated.
CPack: - package: /src/build/platform-0.0.1.0-Linux-runtime.tar.bz2 generated.

Am I missing something?
The cmake version is 3.2.2

Regards,
Tomasz


More information about the CMake mailing list