Make the generation of source RPM packages possible.

This commit is contained in:
Username404-59 2021-03-01 19:28:17 +01:00
parent daeb558504
commit 3b8fcb4409
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
1 changed files with 15 additions and 10 deletions

View File

@ -64,19 +64,24 @@ if (UNIX AND NOT MINGW)
set(CPACK_RPM_PACKAGE_RELEASE ${TIME})
set(CPACK_RPM_PACKAGE_RELEASE_DIST ON)
if (CPACK_RPM_PACKAGE_SOURCES)
set(CPACK_RPM_SOURCE_PKG_PACKAGING_INSTALL_PREFIX "/")
set(CPACK_GENERATOR RPM)
set(CPACK_RPM_BUILDREQUIRES "cmake >= 3.18, clang >= 11.0.0")
set(CPACK_RPM_SOURCE_PKG_PACKAGING_INSTALL_PREFIX "${CPACK_PACKAGING_INSTALL_PREFIX}")
install(DIRECTORY src DESTINATION ${CPACK_RPM_SOURCE_PKG_PACKAGING_INSTALL_PREFIX})
install(DIRECTORY resources DESTINATION ${CPACK_RPM_SOURCE_PKG_PACKAGING_INSTALL_PREFIX})
install(DIRECTORY scripts DESTINATION ${CPACK_RPM_SOURCE_PKG_PACKAGING_INSTALL_PREFIX})
install(FILES CMakeLists.txt desc.txt LICENSE.txt README.md changelog.txt DESTINATION ${CPACK_RPM_SOURCE_PKG_PACKAGING_INSTALL_PREFIX})
else()
if (NOT DEFINED CPACK_GENERATOR)
set(CPACK_GENERATOR TGZ;STGZ;RPM;DEB)
endif()
install(PROGRAMS
${CMAKE_CURRENT_BINARY_DIR}/ybcon
DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/ybcon.d)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/scripts/completions DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/ybcon.d)
install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/ybcon
DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
if (NOT DEFINED CPACK_GENERATOR)
set(CPACK_GENERATOR TGZ;STGZ;RPM;DEB)
endif()
install(PROGRAMS
${CMAKE_CURRENT_BINARY_DIR}/ybcon
DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/ybcon.d)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/scripts/completions DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/ybcon.d)
install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/ybcon
DESTINATION ${CMAKE_INSTALL_BINDIR})
elseif(MINGW OR MSVC)
set(CMAKE_EXE_LINKER_FLAGS "-static -static-libstdc++ ${CMAKE_EXE_LINKER_FLAGS}")
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}_wpkg")