diff --git a/cmake/Rpm.cmake b/cmake/Rpm.cmake index c160eae9f..637645946 100644 --- a/cmake/Rpm.cmake +++ b/cmake/Rpm.cmake @@ -17,6 +17,7 @@ if (LSB_RELEASE_EXEC AND RPMBUILD_EXEC) OUTPUT_STRIP_TRAILING_WHITESPACE ) if (DIST_NAME) + message(STATUS "Distro Name: ${DIST_NAME}") if (DIST_RELEASE) message(STATUS "Distro Release: ${DIST_RELEASE}") @@ -24,38 +25,31 @@ if (LSB_RELEASE_EXEC AND RPMBUILD_EXEC) if (DIST_VERSION) message(STATUS "Distro Version: ${DIST_VERSION}") endif() + set(RPMBUILD_DIR ~/rpmbuild CACHE STRING "Rpmbuild directory, for the rpm target") - if (${DIST_NAME} STREQUAL "opensuse") - if (DIST_RELEASE) - if (${DIST_RELEASE} STREQUAL "leap") - if (DIST_VERSION) - set(RPM_DISTRO "lp${DIST_VERSION}" CACHE STRING "Suffix of the rpm file") - else() - set(RPM_DISTRO ${DIST_RELEASE} CACHE STRING "Suffix of the rpm file") - endif() - elseif (${DIST_RELEASE} STREQUAL "tumbleweed") - set(RPM_DISTRO ${DIST_RELEASE} CACHE STRING "Suffix of the rpm file") - else () - set(RPM_DISTRO ${DIST_NAME} CACHE STRING "Suffix of the rpm file") + + if (${DIST_NAME} STREQUAL "opensuse" AND DIST_RELEASE) + if (${DIST_RELEASE} STREQUAL "leap") + if (DIST_VERSION) + set(RPM_DISTRO "lp${DIST_VERSION}") + else() + set(RPM_DISTRO ${DIST_RELEASE}) endif() - else() - set(RPM_DISTRO ${DIST_NAME} CACHE STRING "Suffix of the rpm file") + elseif (${DIST_RELEASE} STREQUAL "tumbleweed") + set(RPM_DISTRO ${DIST_RELEASE}) endif() - elseif (${DIST_NAME} STREQUAL "fedora") - if (DIST_VERSION) - set(RPM_DISTRO "fc${DIST_VERSION}" CACHE STRING "Suffix of the rpm file") - else () - set(RPM_DISTRO ${DIST_NAME} CACHE STRING "Suffix of the rpm file") - endif() - elseif (${DIST_NAME} STREQUAL "mageia") - if (DIST_RELEASE) - set(RPM_DISTRO "mga${DIST_RELEASE}" CACHE STRING "Suffix of the rpm file") - else () - set(RPM_DISTRO ${DIST_NAME} CACHE STRING "Suffix of the rpm file") - endif() - else() - set(RPM_DISTRO ${DIST_NAME} CACHE STRING "Suffix of the rpm file") + elseif (${DIST_NAME} STREQUAL "fedora" AND DIST_VERSION) + set(RPM_DISTRO "fc${DIST_VERSION}") + elseif (${DIST_NAME} STREQUAL "centos" AND DIST_VERSION) + set(RPM_DISTRO "el${DIST_VERSION}") + elseif (${DIST_NAME} STREQUAL "mageia" AND DIST_RELEASE) + set(RPM_DISTRO "mga${DIST_RELEASE}") endif() + + if(NOT RPM_DISTRO) + set(RPM_DISTRO ${DIST_NAME}) + endif() + message(STATUS "RPM Suffix: ${RPM_DISTRO}") add_custom_target(rpm @@ -64,5 +58,7 @@ if (LSB_RELEASE_EXEC AND RPMBUILD_EXEC) COMMAND ${RPMBUILD_EXEC} -bs ${CMAKE_SOURCE_DIR}/dist/unix/strawberry.spec COMMAND ${RPMBUILD_EXEC} -bb ${CMAKE_SOURCE_DIR}/dist/unix/strawberry.spec ) + endif() + endif()