diff options
author | Domen Vrankar <domen.vrankar@gmail.com> | 2016-10-04 22:43:28 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-10-07 13:19:04 (GMT) |
commit | 758f58b4a18fbb512edd1baf520017e816fee20b (patch) | |
tree | 5d174c556cf38d0bf9dddc03c1e55b4d880cdb22 /Modules | |
parent | 9c4d105680c99e194c6d6063315ee2affd2a7b63 (diff) | |
download | CMake-758f58b4a18fbb512edd1baf520017e816fee20b.zip CMake-758f58b4a18fbb512edd1baf520017e816fee20b.tar.gz CMake-758f58b4a18fbb512edd1baf520017e816fee20b.tar.bz2 |
CPack/RPM learned defining main component
Main component rpm package is generated
without component suffix in filename
and package name.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CPackRPM.cmake | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index 15b62c7..2c8c0e0 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -95,6 +95,17 @@ # and it is up to the packager to set the variables in a manner that will # prevent such errors. # +# .. variable:: CPACK_RPM_MAIN_COMPONENT +# +# Main component that is packaged without component suffix. +# +# * Mandatory : NO +# * Default : - +# +# This variable can be set to any component or group name so that component or +# group rpm package is generated without component suffix in filename and +# package name. +# # .. variable:: CPACK_RPM_PACKAGE_VERSION # # The RPM package version. @@ -1649,10 +1660,16 @@ function(cpack_rpm_generate_package) endif() if(CPACK_RPM_PACKAGE_COMPONENT) - string(APPEND CPACK_RPM_PACKAGE_NAME "-${CPACK_RPM_PACKAGE_COMPONENT}") - cpack_rpm_variable_fallback("CPACK_RPM_PACKAGE_NAME" - "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_NAME" - "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_PACKAGE_NAME") + string(TOUPPER "${CPACK_RPM_MAIN_COMPONENT}" + CPACK_RPM_MAIN_COMPONENT_UPPER) + + if(NOT CPACK_RPM_MAIN_COMPONENT_UPPER STREQUAL CPACK_RPM_PACKAGE_COMPONENT_UPPER) + string(APPEND CPACK_RPM_PACKAGE_NAME "-${CPACK_RPM_PACKAGE_COMPONENT}") + + cpack_rpm_variable_fallback("CPACK_RPM_PACKAGE_NAME" + "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_NAME" + "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_PACKAGE_NAME") + endif() endif() # CPACK_RPM_PACKAGE_VERSION (mandatory) @@ -2164,7 +2181,15 @@ ${TMP_DEBUGINFO_ADDITIONAL_SOURCES} cmake_policy(POP) else() # old file name format for back compatibility - set(CPACK_RPM_FILE_NAME "${CPACK_OUTPUT_FILE_NAME}") + string(TOUPPER "${CPACK_RPM_MAIN_COMPONENT}" + CPACK_RPM_MAIN_COMPONENT_UPPER) + + if(CPACK_RPM_MAIN_COMPONENT_UPPER STREQUAL CPACK_RPM_PACKAGE_COMPONENT_UPPER) + # this is the main component so ignore the component filename part + set(CPACK_RPM_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}.rpm") + else() + set(CPACK_RPM_FILE_NAME "${CPACK_OUTPUT_FILE_NAME}") + endif() endif() # else example: #set(CPACK_RPM_FILE_NAME "${CPACK_RPM_PACKAGE_NAME}-${CPACK_RPM_PACKAGE_VERSION}-${CPACK_RPM_PACKAGE_RELEASE}-${CPACK_RPM_PACKAGE_ARCHITECTURE}.rpm") |