CPackRPM support for Recommends:

this breaks support for Suggests: but we don't use it anyway
This commit is contained in:
Sergei Golubchik 2020-08-04 22:46:31 +02:00
parent 2b856ecd98
commit 694f43644b

View file

@ -2,6 +2,11 @@
# Wrapper for CPackRPM.cmake
#
IF(NOT DEFINED RPM_RECOMMENDS)
EXECUTE_PROCESS(COMMAND rpm --recommends ERROR_QUIET RESULT_VARIABLE RPM_RECOMMENDS)
MESSAGE("CPackRPM:Debug: Testing rpm --recommends: ${RPM_RECOMMENDS}")
ENDIF()
#
# Support for per-component LICENSE and VENDOR
#
@ -47,6 +52,20 @@ if (acc)
file(WRITE ${${base_var}} "${acc}")
endif()
#
# Support for the Recommends: tag.
# We don't use Suggests: so here he hijack Suggests: variable
# to implement Recommends:
#
IF (CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_RECOMMENDS)
IF (RPM_RECOMMENDS EQUAL 0) # exit code 0 means ok
SET(TMP_RPM_SUGGESTS "Recommends: ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_RECOMMENDS}")
ELSE() # rpm is too old to recommend
SET(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_REQUIRES
"${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_REQUIRES} ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_RECOMMENDS}")
ENDIF()
ENDIF()
# load the original CPackRPM.cmake
set(orig_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH})
unset(CMAKE_MODULE_PATH)