mirror of
https://github.com/Kitware/CMake.git
synced 2026-08-08 16:50:48 +00:00
CPack/DEB: Fix regression when package architecture is explicitly specified
Since commit 302a645d73 (CPack/DEB: use `triggers` instead of legacy
postXXX scripts for `ldconfig`, 2026-03-05, v4.4.0-rc1~583^2) the
`triggers` feature refers to `DPKG_EXECUTABLE` if the latter is defined.
Unfortunately, it is defined only if one particular execution branch has
executed. Move the `find_program(dpkg)` to the function scope to make
it available in all execution branches.
This commit is contained in:
@@ -608,13 +608,14 @@ function(cpack_deb_prepare_package_vars)
|
||||
"${CPACK_DEBIAN_PACKAGE_EPOCH}:${CPACK_DEBIAN_PACKAGE_VERSION}")
|
||||
endif()
|
||||
|
||||
find_program(DPKG_EXECUTABLE dpkg)
|
||||
|
||||
# Architecture: (mandatory)
|
||||
if(CPACK_DEB_PACKAGE_COMPONENT AND CPACK_DEBIAN_${_local_component_name}_PACKAGE_ARCHITECTURE)
|
||||
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "${CPACK_DEBIAN_${_local_component_name}_PACKAGE_ARCHITECTURE}")
|
||||
elseif(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE)
|
||||
# There is no such thing as i686 architecture on debian, you should use i386 instead
|
||||
# $ dpkg --print-architecture
|
||||
find_program(DPKG_EXECUTABLE dpkg)
|
||||
if(NOT DPKG_EXECUTABLE)
|
||||
message(STATUS "CPackDeb: Can not find dpkg in your path, default to i386.")
|
||||
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE i386)
|
||||
|
||||
Reference in New Issue
Block a user