CPack: CPACK_BINARY_TGZ does not seems to support for install DESTINATION with absolute path (starts with '/')
I am currently relying on the current behavior of:
install(DIRECTORY ${generated}/ DESTINATION "/")
I've added on-purpose a trailing /
after the ${generated} cmake value.
I am observing expected behavior for the above syntax. For example, on Debian machine:
% cmake --version
cmake version 3.18.4
% DESTDIR=/tmp/toto make install
[...]
-- Installing: /tmp/toto//usr/lib/python3
-- Installing: /tmp/toto//usr/lib/python3/dist-packages
[...]
On rpm-based machine:
# cmake3 --version
cmake3 version 3.13.1
# DESTDIR=/tmp/toto make install
[...]
-- Installing: /tmp/toto//var
-- Installing: /tmp/toto//var/lang
-- Installing: /tmp/toto//var/lang/lib
-- Installing: /tmp/toto//var/lang/lib/python3.8
-- Installing: /tmp/toto//var/lang/lib/python3.8/site-packages
[...]
This also produce the expected behavior for RPM and Deb packages from the respective (above) systems.
For some reason CPACK_BINARY_TGZ
does not like the above syntax, and fails with:
CPack: Create package using TGZ
CPack: Install projects
CPack: - Run preinstall target for: ACME
CPack: - Install project: ACME []
CMake Error at /home/mathieu/workspace/project/bin/python/cmake_install.cmake:54 (file):
file INSTALL cannot set permissions on "/": Operation not permitted.
Call Stack (most recent call first):
/home/mathieu/workspace/project/bin/cmake_install.cmake:49 (include)
CPack Error: Error when generating package: project
reference:
% cmake --version
cmake version 3.18.4
For some reason, the syntax is accepted by cmake version 3.13.1
Edited by Mathieu Malaterre