Add RPM packaging support (#5177)
* Add RPM packaging support
Using the existing PackageDebian as template add support for
generating an rpm with the package target.
* Restore debian package target
Also add an option to advertise the fact.
* Update package description
C-n-p from README.md
* Update rpm package maintainer
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4211e58..b0562ba 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -23,7 +23,13 @@
option(FLATBUFFERS_CODE_SANITIZE
"Add '-fsanitize' flags to 'flattests' and 'flatc' targets."
OFF)
-
+option(FLATBUFFERS_PACKAGE_REDHAT
+ "Build an rpm using the 'package' target."
+ OFF)
+option(FLATBUFFERS_PACKAGE_DEBIAN
+ "Build an deb using the 'package' target."
+ OFF)
+
if(NOT FLATBUFFERS_BUILD_FLATC AND FLATBUFFERS_BUILD_TESTS)
message(WARNING
"Cannot build tests without building the compiler. Tests will be disabled.")
@@ -443,6 +449,13 @@
include(CMake/BuildFlatBuffers.cmake)
-if(FLATBUFFERS_PACKAGE_DEBIAN)
- include(CMake/PackageDebian.cmake)
+if(UNIX)
+ # Use of CPack only supported on Linux systems.
+ if(FLATBUFFERS_PACKAGE_DEBIAN)
+ include(CMake/PackageDebian.cmake)
+ endif()
+ if (FLATBUFFERS_PACKAGE_REDHAT)
+ include(CMake/PackageRedhat.cmake)
+ endif()
+ include(CPack)
endif()