IF(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux") MESSAGE(FATAL_ERROR "Cannot configure CPack to generate Debian/RPM packages on non-linux systems.") ENDIF() string(TOLOWER "${CMAKE_PROJECT_NAME}" CPACK_PACKAGE_NAME) SET(CPACK_PACKAGE_VERSION_MAJOR ${OSRM_VERSION_MAJOR}) SET(CPACK_PACKAGE_VERSION_MINOR ${OSRM_VERSION_MINOR}) SET(CPACK_PACKAGE_VERSION_PATCH ${OSRM_VERSION_PATCH}) SET(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}") SET(CPACK_INCLUDE_TOPLEVEL_DIRECTORY "FALSE") SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.md") SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Open Source Routing Machine (OSRM) is a high-performance routing engine. It combines sophisticated routing algorithms with the open and free data of the OpenStreetMap.") SET(CPACK_PACKAGE_CONTACT "Project OSRM ") SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE.TXT") SET(CPACK_STRIP_FILES "TRUE") file(GLOB_RECURSE ProfileGlob ${CMAKE_SOURCE_DIR}/profiles/*) install(FILES ${ProfileGlob} DESTINATION "share/doc/${CPACK_PACKAGE_NAME}/profiles") find_program(DPKG_PROGRAM dpkg DOC "dpkg program of Debian-based systems") if(DPKG_PROGRAM) SET(CPACK_GENERATOR "DEB") execute_process( COMMAND ${DPKG_PROGRAM} --print-architecture OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE ) SET(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}") SET(CPACK_DEBIAN_PACKAGE_SHLIBDEPS "ON") else(DPKG_PROGRAM) find_program(RPM_PROGRAM rpm DOC "rpm RPM-based systems") find_program(RPMBUILD_PROGRAM rpm DOC "rpm RPM-based systems") if(RPMBUILD_PROGRAM) SET(CPACK_GENERATOR "RPM") execute_process( COMMAND ${RPM_PROGRAM} --eval %{_arch} OUTPUT_VARIABLE CPACK_RPM_PACKAGE_ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE ) SET(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}.${CPACK_RPM_PACKAGE_ARCHITECTURE}") # Exclude /usr/lib64/pkgconfig directory given that it is already owned by the pkg-config rpm package. SET(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/usr/${CMAKE_INSTALL_LIBDIR}/pkgconfig") endif(RPMBUILD_PROGRAM) endif(DPKG_PROGRAM)