CMake ARCHIVE_CREATE with relative paths
09:49 06 Nov 2023

I have a project where I use CMake's ARCHIVE_CREATE, it correctly generates the '.zip' file, here is the code:

file(ARCHIVE_CREATE
  OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/bundle.zip"
  PATHS "${CMAKE_CURRENT_SOURCE_DIR}/assets/demo"
  FORMAT "zip"
  VERBOSE
)

Where ${CMAKE_CURRENT_SOURCE_DIR}/assets/demo dir has:

$ tree
.
├── blob
│   └── matrix.avif
└── scripts
    └── main.lua

However, the final directory structure is different, as shown in the image below:

My question is: how can I make sure the compressed file structure is exactly the same as the directory?

cmake