diff --git a/CMakeLists.txt b/CMakeLists.txt index 87b8006..dd8aec0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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")