Add option to build DEB package.

This commit is contained in:
Kirill Kirilenko 2021-04-07 22:28:41 +03:00
parent f158466213
commit d5583c9a6c
2 changed files with 20 additions and 0 deletions

View file

@ -6,6 +6,7 @@ project(libwebrtc)
option(GN_EXTRA_ARGS "Extra 'gn gen' arguments to pass when configuring WebRTC" "")
option(NINJA_ARGS "Ninja arguments to pass when compiling WebRTC" "")
option(BUILD_DEB_PACKAGE "Build .deb package" OFF)
# Allow the use of IN_LIST operand
cmake_policy(SET CMP0057 NEW)

View file

@ -1,3 +1,7 @@
if (BUILD_DEB_PACKAGE)
set(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH INTERNAL FORCE)
endif ()
# Prepare CMake exports
configure_file(LibWebRTCConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/LibWebRTCConfig.cmake @ONLY)
configure_file(LibWebRTCConfigVersion.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/LibWebRTCConfigVersion.cmake @ONLY)
@ -81,3 +85,18 @@ else ()
install(FILES LibWebRTCTargets-release.cmake DESTINATION "lib/cmake/LibWebRTC")
endif ()
endif ()
if (BUILD_DEB_PACKAGE)
set(CPACK_GENERATOR "DEB")
set(CPACK_PACKAGE_NAME "libwebrtc-dev")
set(CPACK_PACKAGE_VENDOR "Kirill Kirilenko")
set(CPACK_PACKAGE_CONTACT "Kirill Kirilenko <kirill@ultracoder.org>")
set(CPACK_PACKAGE_VERSION_MAJOR ${WEBRTC_VERSION})
set(CPACK_PACKAGE_VERSION_MINOR "")
set(CPACK_PACKAGE_VERSION_PATCH "")
set(CPACK_PACKAGE_DESCRIPTION "WebRTC static library and header files")
set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/UltraCoderRU/libwebrtc")
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${WEBRTC_VERSION}")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "")
include(CPack)
endif ()