MantisBT - CMake
View Issue Details
0008767CMakeCPackpublic2009-03-19 11:282016-05-02 08:30
Derek Bruening 
Domen Vrankar 
normalminoralways
closedfixed 
 
CMake 3.4 
0008767: CPack tar generators ignore empty directories
I want to include an empty directory in my tarball, but the CPack tar generators (mainly I was using TGZ) refuse to add it: they just ignore it.

I tried adding it to CPACK_INSTALLED_DIRECTORIES.

I ended up having to put a dummy file inside the directory in order to get it included.
No tags attached.
related to 0013009closed Raffi Enficiaud CPack DEB generator ignores top-level directories which do not contain a file 
gz CPackWithEmptyDir-0.1.1-Source.tar.gz (548) 2012-01-04 08:56
https://public.kitware.com/Bug/file/4162/CPackWithEmptyDir-0.1.1-Source.tar.gz
Issue History
2009-03-19 11:28Derek BrueningNew Issue
2009-03-22 22:01Bill HoffmanStatusnew => assigned
2009-03-22 22:01Bill HoffmanAssigned To => Bill Hoffman
2012-01-04 08:56Eric NOULARDFile Added: CPackWithEmptyDir-0.1.1-Source.tar.gz
2012-01-04 08:57Eric NOULARDNote Added: 0028156
2012-01-04 09:05Eric NOULARDNote Added: 0028157
2012-01-04 23:48Fraser HutchisonNote Added: 0028187
2012-01-05 00:10Fraser HutchisonNote Added: 0028188
2012-03-02 07:13Eric NOULARDRelationship addedrelated to 0013009
2015-10-10 03:54Domen VrankarNote Added: 0039559
2015-10-10 03:54Domen VrankarStatusassigned => resolved
2015-10-10 03:54Domen VrankarFixed in Version => CMake 3.4
2015-10-10 03:54Domen VrankarResolutionopen => fixed
2015-10-10 03:54Domen VrankarAssigned ToBill Hoffman => Domen Vrankar
2016-05-02 08:30Robert MaynardNote Added: 0040969
2016-05-02 08:30Robert MaynardStatusresolved => closed

Notes
(0028156)
Eric NOULARD   
2012-01-04 08:57   
Same problem popped up again on the list:
http://www.cmake.org/pipermail/cmake/2012-January/048371.html [^]

This has been unanswered in the past too:
http://www.cmake.org/pipermail/cmake/2008-November/025435.html [^]

Just uploaded a project which exhibit the issue.
(0028157)
Eric NOULARD   
2012-01-04 09:05   
The problem seems to be with all Archive generators:
STGZ TBZ2 TGZ TZ ZIP


It's even worse with ZIP which core dump (CMake 2.8.7) with the attached example.
This last error seems to be gone with the newly imported libarchive
currently in next.
(0028187)
Fraser Hutchison   
2012-01-04 23:48   
This appears to be easily fixed by removing "gl.RecurseOn();" from Source\CPack\cmCPackGenerator.cxx (currently line 1002) http://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/CPack/cmCPackGenerator.cxx;h=083279fdda70420ae9f6021d5ddc033841499ba7;hb=refs/heads/next#l1002 [^])

The problem seems to boil down to the different behaviour between GLOB and GLOB_RECURSE where the former includes directories in the set of results and the latter doesn't.

I only tested this on Windows 7, but all Archive generators correctly add an empty directory to the install path using the command:

install(DIRECTORY DESTINATION GlobRecurseStrikesAgain)

There may be a very minor backwards compatibility issue if globbing recursion is switched off in cmCPackGenerator however. The command:

install(DIRECTORY "${LOCALDIRNAME}" DESTINATION include)

currently ignores empty subdirectories located within ${LOCALDIRNAME}, but would install them also if the above change is made.
(0028188)
Fraser Hutchison   
2012-01-05 00:10   
OK - not as straightforward as I first thought!

Apparently the globbing recursion is necessary to correctly create the uninstaller (for non-Archive generators). With recursion off, the uninstaller leaves behind any non-empty folders.

I guess rather than removing "gl.RecurseOn();" it needs wrapped in an "if non-Archive" condition.
(0039559)
Domen Vrankar   
2015-10-10 03:54   
Fixed with commit:
https://cmake.org/gitweb?p=cmake.git;a=commit;h=9298f56 [^]
(0040969)
Robert Maynard   
2016-05-02 08:30   
Closing resolved issues that have not been updated in more than 4 months.