CPack: The default value of CPACK_DEBIAN_PACKAGE_HOMEPAGE, CPACK_RPM_PACKAGE_URL, and CPACK_FREEBSD_PACKAGE_WWW are wrong
According to the documentation below, the default value of CPACK_DEBIAN_PACKAGE_HOMEPAGE
, CPACK_RPM_PACKAGE_URL
, and CPACK_FREEBSD_PACKAGE_WWW
are CMAKE_PROJECT_HOMEPAGE_URL
.
- https://cmake.org/cmake/help/latest/cpack_gen/deb.html#variable:CPACK_DEBIAN_PACKAGE_HOMEPAGE
- https://cmake.org/cmake/help/latest/cpack_gen/rpm.html#variable:CPACK_RPM_PACKAGE_URL
- https://cmake.org/cmake/help/latest/cpack_gen/freebsd.html#variable:CPACK_FREEBSD_PACKAGE_WWW
However, the cpack
command cannot read the CMAKE_PROJECT_HOMEPAGE_URL
variable. Therefore, the default value is not set to them.
Small experiment
-
Create an empty CMake project.
CMakeLists.txt
cmake_minimum_required(VERSION 3.12) project(FOOBAR LANGUAGES NONE HOMEPAGE_URL "http://example.com") set(CPACK_GENERATOR DEB) set(CPACK_PACKAGE_CONTACT "email@example.com") include(CPack)
-
Generate a deb package.
cmake . cpack -C Release
-
Check its
Homepage
metadata.dpkg --info FOOBAR-0.1.1-Linux.deb
But,
Homepage
is missing. It should behttp://example.com
if the documentation is true.
Proposal to resolve the problem
Replace CMAKE_PROJECT_HOMEPAGE_URL
with CPACK_PACKAGE_HOMEPAGE_URL
in the following lines.
-
# Homepage: (optional) if(NOT CPACK_DEBIAN_PACKAGE_HOMEPAGE AND CMAKE_PROJECT_HOMEPAGE_URL) # <--- here set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "${CMAKE_PROJECT_HOMEPAGE_URL}") # <--- and here endif()
-
if(NOT CPACK_RPM_PACKAGE_URL AND CMAKE_PROJECT_HOMEPAGE_URL) # <--- here set(CPACK_RPM_PACKAGE_URL "${CMAKE_PROJECT_HOMEPAGE_URL}") # <--- and here endif()
-
# There's really only one homepage for a project, so # re-use the Debian setting if it's there. _cpack_freebsd_fallback_var("CPACK_FREEBSD_PACKAGE_WWW" "CMAKE_PROJECT_HOMEPAGE_URL" # <--- here "CPACK_DEBIAN_PACKAGE_HOMEPAGE" "_cpack_freebsd_fallback_www" )
These lines were added in !1816 (merged). I think they were not tested well.
Edited by Kenta Kubo