MantisBT - CMake
View Issue Details
0010130CMakeCPackpublic2010-01-12 17:512010-08-31 16:37
Clinton Stimpson 
Eric NOULARD 
normalminorhave not tried
closedfixed 
 
CMake-2-8 
0010130: cpack components for non-component generators
I would like to be able to choose what components to include in a package, even when a non-component based generator is used.

So, if I make a .zip or .tar.gz file, I want to be able to choose that a Runtime and Help component get included in there, when a Development component is not.

And I want the way of specifying that to work across all generators.
I can already customize how those components show up in the NSIS installer, with extra variables.
No tags attached.
related to 0010736closed Eric NOULARD Enable CPack generators to produce more than one package 
related to 0009900closed Eric NOULARD Make CPack generic generator delegate the name of the file to specific generator 
Issue History
2010-01-12 17:51Clinton StimpsonNew Issue
2010-08-02 19:03Eric NOULARDRelationship addedrelated to 0010736
2010-08-02 19:04Eric NOULARDRelationship addedrelated to 0009900
2010-08-02 19:44Clinton StimpsonNote Added: 0021600
2010-08-04 10:22Eric NOULARDNote Added: 0021635
2010-08-04 12:43Clinton StimpsonNote Added: 0021642
2010-08-04 12:49Eric NOULARDNote Added: 0021643
2010-08-04 13:12Clinton StimpsonNote Added: 0021646
2010-08-04 13:45Eric NOULARDNote Added: 0021647
2010-08-21 08:25Eric NOULARDStatusnew => assigned
2010-08-21 08:25Eric NOULARDAssigned To => Eric NOULARD
2010-08-21 08:27Eric NOULARDNote Added: 0021870
2010-08-31 16:37Eric NOULARDNote Added: 0022036
2010-08-31 16:37Eric NOULARDStatusassigned => closed
2010-08-31 16:37Eric NOULARDResolutionopen => fixed
2010-08-31 16:37Eric NOULARDFixed in Version => CMake-2-8

Notes
(0021600)
Clinton Stimpson   
2010-08-02 19:44   
Let me clarify.

This is basically asking that CPACK_COMPONENTS_ALL work for all cpack generators, and not just NSIS and PackageMaker.

This is to allow control of component packaging with the cpack config, while not having to write more complicated cmake code like this:
if(devel_install)
  install(... COMPONENT Runtime
          ... COMPONENT Development)
else()
  install(... COMPONENT Runtime)
endif()
(0021635)
Eric NOULARD   
2010-08-04 10:22   
Have a look at latest 10736 patchset.
Now for every CPack Archive Generators, the default behavior
is to build 1 archive file per component group (found in the CPACK_COMPONENTS_ALL list)

If you want 1 archive file per component then specify
CPACK_COMPONENT_IGNORE_COMPONENT_GROUP=1

If you want all-in-one archive then specify
CPACK_MONOLITHIC_INSTALL.

Does all those combination suits your needs?
(0021642)
Clinton Stimpson   
2010-08-04 12:43   
I like that it is respecting components I've chosen to package. That lets me create different packages for different customers.

But with the CPACK_MONOLITHIC_INSTALL option, its creating a .tar.gz package with
a directory structure divided up by components. I don't want that.

I want a
/bin
/lib
/share
etc...

not
/Runtime/bin
/Development/lib
/Runtime/share
etc...
(0021643)
Eric NOULARD   
2010-08-04 12:49   
Clint,

What is your platform?
On my Linux box if I do

mkdir Build
cd Build
cmake -DCPACK_MONOLITHIC_INSTALL=1 <path>/to/Source

make
cpack -G TGZ

I end up with no "component name" inside ?

Would you retry from a fresh build tree?
(0021646)
Clinton Stimpson   
2010-08-04 13:12   
I just edited the CPackConfig.cmake of an existing project and ran the new cpack on it.

From a new test project
====
file(WRITE file.txt.in "hi")

configure_file(file.txt.in ${CMAKE_CURRENT_BINARY_DIR}/file-runtime.txt)
configure_file(file.txt.in ${CMAKE_CURRENT_BINARY_DIR}/file-devel.txt)

install(FILES ${CMAKE_CURRENT_BINARY_DIR}/file-runtime.txt
        DESTINATION bin COMPONENT Runtime)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/file-devel.txt
        DESTINATION lib COMPONENT Development)

SET(CPACK_COMPONENTS_ALL Runtime Unspecified)
set(CPACK_MONOLITHIC_INSTALL 1)
include(CPack)
====
I get this warning when doing an include(CPack)
CPack warning: both CPACK_COMPONENTS_ALL and CPACK_MONOLITHIC_INSTALL have been set.

When I look at the CPackConfig.cmake, CPACK_COMPONENTS_ALL is missing, so I've lost control over which components to package.
If I edit the CPackConfig.cmake and put CPACK_COMPONENTS_ALL in it, then I get the behavior I was telling you before.
(0021647)
Eric NOULARD   
2010-08-04 13:45   
Ok right,

I understand now.
CPACK_MONOLITHIC_INSTALL is exclusive with
CPACK_COMPONENTS_ALL.

CPACK_MONOLITHIC_INSTALL basically ignore components
whereas CPACK_COMPONENTS_ALL describe the components
you want to install.

What you want is to have a **single** package containing
all components listed in CPACK_COMPONENTS_ALL.

The feature you want is more like having
CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE :-)

This options would only makes sense for
"natively multiple files" CPack generator
like Archive Generator or RPM, DEB etc...

may be for the next patch :-)
The current implementation (of the Archive Generator)
does not enable that behavior.
But off course ... it could be implemented.
(0021870)
Eric NOULARD   
2010-08-21 08:27   
Hi Clint,

I think my last update for component support in Archive Generators
should fulfills all your needs.
see sibling bug:
http://public.kitware.com/Bug/view.php?id=10736 [^]
(0022036)
Eric NOULARD   
2010-08-31 16:37   
commit 65fa0f02351e1564d60b266594b425094dce1959
The following merge to master should fix the problem:

Merge: f95074b a986daf
Author: Brad King <brad.king@kitware.com>
Date: Tue Aug 31 14:24:32 2010 -0400

    Merge topic 'CPackArchiveGenerator-ComponentSupport'
    
    a986daf CPack fix broken compilation for CygwinSource generator
    873e99a CPackArchiveGenerator improve usability and robustness
    654683a CPackArchiveGenerator add component supports
    36a550a CPackArchiveGenerator use cmArchiveWrite wrapper