View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0013599CMakeCMakepublic2012-10-22 15:272012-10-23 13:02
Reportersutasu 
Assigned ToEric NOULARD 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionwon't fix 
Platformx86OSwin, linuxOS Versionany
Product VersionCMake 2.8.9 
Target VersionFixed in Version 
Summary0013599: package per component generation doesn't work
DescriptionAccording to documentation the default behavior for following code is producing 2 packages files (one per component) but it makes only one.
Steps To Reproducecmake_minimum_required(VERSION 2.8)

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 Development)
include(CPack)
Additional Information> cmake ..
-- Building for: Visual Studio 8 2005
-- Check for working C compiler using: Visual Studio 8 2005
-- Check for working C compiler using: Visual Studio 8 2005 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler using: Visual Studio 8 2005
-- Check for working CXX compiler using: Visual Studio 8 2005 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Projects/cmake_multiple_tst/build

> cpack -G ZIP
CPack: Create package using ZIP
CPack: Install projects
CPack: - Install project: Project
CPack: Create package
CPack: - package: C:/Projects/cmake_multiple_tst/build/Project-0.1.1-win32.zip generated.
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0031289)
Eric NOULARD (developer)
2012-10-22 15:48

Hi,

Where do you mean by "According to documentation".
For some generator component packaging is not the default behavior,
see here:
http://www.cmake.org/Wiki/CMake:Component_Install_With_CPack#CPack_Generator_specific_behavior [^]

The default behavior of the ZIP generator (which is a sub-class of Archive generator) is to not generate several packages for backward compatibility reason.

However running:
cpack -D CPACK_ARCHIVE_COMPONENT_INSTALL=1 -G ZIP

should produce the 2 packages.
You can
set(CPACK_ARCHIVE_COMPONENT_INSTALL 1)
inside your CMakeLists.txt as well.
(0031290)
Eric NOULARD (developer)
2012-10-22 15:49

I'll wait for your feedback before closing this.
(0031293)
sutasu (reporter)
2012-10-23 11:06

Documentation mentions that for archive generators cpack possibly generates multiple package files which is quite vague.
Then is says "For CPack generators which generates several packages the default behavior is to generate one package per COMPONENT GROUP".

The code above doesn't use component groups though I tried using them too.

And there is no any traces in this documentation of CPACK_ARCHIVE_COMPONENT_INSTALL variable.

It's a pity that it's so hard for even not a newbie of cmake to figure out how to do such a simple thing... In general please provide more examples in documentation, give more details on every aspect. I find that it often takes too much experimentation using cmake and cpack to achieve a goal.

Anyway thank you!

Back to the problem... On windows the suggestion you gave worked perfectly:

C:\Projects\cmake_multiple_tst\build>cpack -D CPACK_ARCHIVE_COMPONENT_INSTALL=1
-G ZIP
CPack: Create package using ZIP
CPack: Install projects
CPack: - Install project: Project
CPack: - Install component: Runtime
CPack: - Install component: Development
CPack: Create package
CPack: - package: C:/Projects/cmake_multiple_tst/build/Project-0.1.1-win32-Devel
opment.zip generated.
CPack: - package: C:/Projects/cmake_multiple_tst/build/Project-0.1.1-win32-Runti
me.zip generated.

C:\Projects\cmake_multiple_tst\build>cpack -D CPACK_ARCHIVE_COMPONENT_INSTALL=1
-G TGZ
CPack: Create package using TGZ
CPack: Install projects
CPack: - Install project: Project
CPack: - Install component: Runtime
CPack: - Install component: Development
CPack: Create package
CPack: - package: C:/Projects/cmake_multiple_tst/build/Project-0.1.1-win32-Devel
opment.tar.gz generated.
CPack: - package: C:/Projects/cmake_multiple_tst/build/Project-0.1.1-win32-Runti
me.tar.gz generated.

C:\Projects\cmake_multiple_tst\build>cpack -D CPACK_ARCHIVE_COMPONENT_INSTALL=1
-G TBZ2
CPack: Create package using TBZ2
CPack: Install projects
CPack: - Install project: Project
CPack: - Install component: Runtime
CPack: - Install component: Development
CPack: Create package
CPack: - package: C:/Projects/cmake_multiple_tst/build/Project-0.1.1-win32-Devel
opment.tar.bz2 generated.
CPack: - package: C:/Projects/cmake_multiple_tst/build/Project-0.1.1-win32-Runti
me.tar.bz2 generated.


But on linux it produced three packages with the same content of both components:

> cpack -DCPACK_ARCHIVE_COMPONENT_INSTALL=1 -G TGZ
CPack: Create package using STGZ
CPack: Install projects
CPack: - Run preinstall target for: Project
CPack: - Install project: Project
CPack: Create package
CPack: - package: /home/stanislav/Projects/cmake_test/build/Project-0.1.1-Linux.sh generated.
CPack: Create package using TGZ
CPack: Install projects
CPack: - Run preinstall target for: Project
CPack: - Install project: Project
CPack: Create package
CPack: - package: /home/stanislav/Projects/cmake_test/build/Project-0.1.1-Linux.tar.gz generated.
CPack: Create package using TZ
CPack: Install projects
CPack: - Run preinstall target for: Project
CPack: - Install project: Project
CPack: Create package
CPack: - package: /home/stanislav/Projects/cmake_test/build/Project-0.1.1-Linux.tar.Z generated.

Thank you!
(0031294)
Eric NOULARD (developer)
2012-10-23 11:30

I know CPack documentation is sparse but I can ensure
you it is improving....and
I would kindly accept patch for the documentation as well.

Concerninng the wrong linux behavior, you have a small command
line typo:
cpack -DCPACK_ARCHIVE_COMPONENT_INSTALL=1 -G TGZ

should be:
cpack -D CPACK_ARCHIVE_COMPONENT_INSTALL=1 -G TGZ

there must be a " " [space] between -D and var value.
In any case if you get tree kind of packages and asked
for only one (-G TGZ) then there must be some command line issue.

And...yes the command line parsing should be improved,.
(0031295)
sutasu (reporter)
2012-10-23 12:03

I see...))) Usually space doesn't make any difference in command line parsers.
Thank you for being cooperative and good luck!
Let's consider this discussion closed.
(0031296)
Eric NOULARD (developer)
2012-10-23 13:02

Nothing to fix or may be the doc.

 Issue History
Date Modified Username Field Change
2012-10-22 15:27 sutasu New Issue
2012-10-22 15:45 Eric NOULARD Priority high => normal
2012-10-22 15:45 Eric NOULARD Severity major => minor
2012-10-22 15:45 Eric NOULARD Assigned To => Eric NOULARD
2012-10-22 15:45 Eric NOULARD Status new => assigned
2012-10-22 15:48 Eric NOULARD Note Added: 0031289
2012-10-22 15:49 Eric NOULARD Note Added: 0031290
2012-10-22 15:49 Eric NOULARD Status assigned => feedback
2012-10-23 11:06 sutasu Note Added: 0031293
2012-10-23 11:06 sutasu Status feedback => assigned
2012-10-23 11:30 Eric NOULARD Note Added: 0031294
2012-10-23 12:03 sutasu Note Added: 0031295
2012-10-23 13:02 Eric NOULARD Note Added: 0031296
2012-10-23 13:02 Eric NOULARD Status assigned => closed
2012-10-23 13:02 Eric NOULARD Resolution open => won't fix


Copyright © 2000 - 2018 MantisBT Team