CPack Archive generator ignores CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY when using components
I am attaching a small project demonstrating the issue (cpack-test.zip). You can simply "run it"
mkdir build
cd build
cmake ..
cmake --build . --target archive-zip
Scanning dependencies of target cpack_test
[ 50%] Building CXX object CMakeFiles/cpack_test.dir/main.cpp.o
[100%] Linking CXX executable cpack_test
[100%] Built target cpack_test
Scanning dependencies of target archive-zip
Creating archive...
CPack: Enable Verbose
CPack Verbose: Read CPack config file:
CPack Verbose: Read CPack configuration file: /mnt/vault/tmp/misc-projects/cpack-test/build/CPackConfig.cmake
CPack Verbose: Specified generator: ZIP
CPack Verbose: Use generator: cmCPackArchiveGenerator
CPack Verbose: For project: CPackTestArchive
CPack: Create package using ZIP
CPack Verbose: Read description file: /Applications/CMake.app/Contents/share/cmake-3.17/Templates/CPack.GenericDescription.txt
CPack Verbose: [ZIP] requested component grouping = ALL_COMPONENTS_IN_ONE
CPack Verbose: [ZIP] requested component grouping = ALL_COMPONENTS_IN_ONE
CPack: Install projects
CPack: - Install directory: /mnt/vault/tmp/misc-projects/cpack-test/docs
CPack: - Run preinstall target for: cpack_test
CPack: - Install project: cpack_test [Debug]
CPack: - Install component: vst2
CPack Verbose: Install configuration: "Debug"
CPack Verbose: Installing: /mnt/vault/tmp/misc-projects/cpack-test/build/_CPack_Packages/Darwin/ZIP/CPackTestArchive-1.0.0-Darwin/vst2/CPackTestArchive-1.0.0-Darwin/vst2/cpack_test_Debug_vst2
CPack: - Install component: vst3
CPack Verbose: Install configuration: "Debug"
CPack Verbose: Installing: /mnt/vault/tmp/misc-projects/cpack-test/build/_CPack_Packages/Darwin/ZIP/CPackTestArchive-1.0.0-Darwin/vst3/CPackTestArchive-1.0.0-Darwin/vst3/cpack_test_Debug_vst3
CPack: Create package
CPack Verbose: Package files to: /mnt/vault/tmp/misc-projects/cpack-test/build/_CPack_Packages/Darwin/ZIP/CPackTestArchive-1.0.0-Darwin.zip
CPack Verbose: Packaging all groups in one package...(CPACK_COMPONENTS_ALL_GROUPS_IN_ONE_PACKAGE is set)
CPack Verbose: - packaging component: vst2
CPack Verbose: - packaging component: vst3
CPack Verbose: Copying final package(s) [1]:
CPack: - package: /mnt/vault/tmp/misc-projects/cpack-test/build/CPackTestArchive-1.0.0-Darwin.zip generated.
Built target archive-zip
It uses
set(CPACK_INSTALLED_DIRECTORIES "${CMAKE_CURRENT_LIST_DIR}/docs" ".")
in order to include a docs folder at the root of the archive (so that there are instructions on what to do) and although the staging folder contains it:
ls -la _CPack_Packages/Darwin/ZIP/CPackTestArchive-1.0.0-Darwin
total 16
drwxr-xr-x 5 ypujante staff 170 Aug 20 10:41 ./
drwxr-xr-x 4 ypujante staff 136 Aug 20 10:41 ../
-rw-r--r-- 1 ypujante staff 22 Aug 20 08:50 Readme.txt
drwxr-xr-x 3 ypujante staff 102 Aug 20 10:41 vst2/
drwxr-xr-x 3 ypujante staff 102 Aug 20 10:41 vst3/
the resulting archive does not:
jar tvf CPackTestArchive-1.0.0-Darwin.zip
0 Thu Aug 20 10:41:35 PDT 2020 CPackTestArchive-1.0.0-Darwin/vst2/
18844 Thu Aug 20 10:41:34 PDT 2020 CPackTestArchive-1.0.0-Darwin/vst2/cpack_test_Debug_vst2
0 Thu Aug 20 10:41:35 PDT 2020 CPackTestArchive-1.0.0-Darwin/vst3/
18844 Thu Aug 20 10:41:34 PDT 2020 CPackTestArchive-1.0.0-Darwin/vst3/cpack_test_Debug_vst3
Yan