[cmake-developers] [CMake 0013019]: The ZIP package generator does not find the files when CPACK_PACKAGING_INSTALL_PREFIX is set
Mantis Bug Tracker
mantis at public.kitware.com
Tue Mar 6 10:00:37 EST 2012
The following issue has been SUBMITTED.
======================================================================
http://public.kitware.com/Bug/view.php?id=13019
======================================================================
Reported By: Harald Winroth
Assigned To:
======================================================================
Project: CMake
Issue ID: 13019
Category: CPack
Reproducibility: always
Severity: major
Priority: normal
Status: new
======================================================================
Date Submitted: 2012-03-06 10:00 EST
Last Modified: 2012-03-06 10:00 EST
======================================================================
Summary: The ZIP package generator does not find the files
when CPACK_PACKAGING_INSTALL_PREFIX is set
Description:
I use components and generate one binary package ZIP for each component. If
CPACK_PACKAGING_INSTALL_PREFIX is not set, everything works as expected. But
when I set CPACK_PACKAGING_INSTALL_PREFIX to "/MyPrefix", the package generator
is unable to find the files when compressing, resulting in the error message:
CPack: Create package
1>CPack Error: ERROR while packaging files: archive_read_disk_entry_from_file:
(Empty error message)
1>CPack Error: Problem compressing the directory
Steps to Reproduce:
In CMakeLists.txt:
set (CPACK_COMPONENTS_ALL core)
set (CPACK_ARCHIVE_COMPONENT_INSTALL 1)
In CPackProjectConfig.cmake:
set (CPACK_PACKAGING_INSTALL_PREFIX "/MyPrefix")
"C:\Program Files\CMake 2.8\bin\cpack.exe" -C Debug --config ./CPackConfig.cmake
Additional Information:
In Source\CPack\cmCPackGenerator.cxx line 849:
localFileName =
cmSystemTools::RelativePath(InstallPrefix, fit->c_str());
localFileName =
localFileName.substr(localFileName.find('/')+1,
std::string::npos);
Now, when CPACK_PACKAGING_INSTALL_PREFIX is NOT set, fit is
"C:/MyPath/_CPack_Packages/win32/ZIP/MyPackage-win32/core//bin/MyLib.dll" and
InstallPrefix is "C:/MyPath/_CPack_Packages/win32/ZIP/MyPackage-win32/core/”.
Note the double slash in fit, it looks strange. After line 849 has executed,
localFileName is "/bin/MyLib.dll”. Then, line 851 removes the leading slash,
leaving "bin/MyLib.dll” in localFileName, and everything works.
However, if I set CPACK_PACKAGING_INSTALL_PREFIX to "/MyPrefix", then at line
849 above fit is
"C:/MyPath/_CPack_Packages/win32/ZIP/MyPackage-win32/core/MyPrefix/bin/MyLib.dll"
(note: no double slash in the path) and InstallPrefix is
"C:/MyPath/_CPack_Packages/win32/ZIP/MyPackage-win32/core/MyPrefix". Line 489
sets localFileName to “bin/MyLib.dll” (which is the correct file name), but
then line 851 strips of “bin/”, leaving just “MyLib.dll” in
localFileName. That path will not be found later on.
But there also seems to be other problems in the code. The
CPACK_PACKAGING_INSTALL_PREFIX doesn't seem to be taken into account futher down
when the ZIP archive is created. Is the prefix parameter of the AddFile call
suppose to be used for this?
======================================================================
Issue History
Date Modified Username Field Change
======================================================================
2012-03-06 10:00 Harald Winroth New Issue
======================================================================
More information about the cmake-developers
mailing list