1if (UNIX)
2    set(CPACK_GENERATOR "RPM")
3    set(CPACK_SOURCE_TGZ "ON")
4
5    set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "FlatBuffers serialization library and schema compiler.")
6
7    set(CPACK_RPM_PACKAGE_HOMEPAGE "https://github.com/google/flatbuffers")
8    set(CPACK_RPM_PACKAGE_MAINTAINER "Marc Butler <mockbutler@gmail.com>")
9
10    set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
11    set(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
12    set(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH})
13    set(CPACK_PACKAGE_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}-${VERSION_COMMIT}")
14    set(CPACK_RPM_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}")
15
16    set(CPACK_RPM_PACKAGE_NAME "flatbuffers")
17
18    # Assume this is not a cross complation build.
19    if(NOT CPACK_RPM_PACKAGE_ARCHITECTURE)
20        set(CPACK_RPM_PACKAGE_ARCHITECTURE "${CMAKE_SYSTEM_PROCESSOR}")
21    endif(NOT CPACK_RPM_PACKAGE_ARCHITECTURE)
22
23    set(CPACK_RPM_PACKAGE_VENDOR "Google, Inc.")
24    set(CPACK_RPM_PACKAGE_LICENSE "Apache 2.0")
25    set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/LICENSE.txt)
26    set(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_SOURCE_DIR}/CMake/DESCRIPTION.txt)
27
28    # This may reduce rpm compatiblity with very old systems.
29    set(CPACK_RPM_COMPRESSION_TYPE lzma)
30
31    set(CPACK_RPM_PACKAGE_NAME "flatbuffers")
32    set(CPACK_PACKAGE_FILE_NAME
33        "${CPACK_RPM_PACKAGE_NAME}_${CPACK_RPM_PACKAGE_VERSION}_${CPACK_RPM_PACKAGE_ARCHITECTURE}")
34endif(UNIX)
35