Skip to content
This repository has been archived by the owner on Jun 30, 2021. It is now read-only.

Commit

Permalink
Add CPack commands to build a debian package.
Browse files Browse the repository at this point in the history
  • Loading branch information
pusateri committed Feb 24, 2016
1 parent 13275a6 commit 0c4a8ec
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -391,4 +391,48 @@ else(CMAKE_BUILD_TYPE MATCHES Release)
message(" ${CMAKE_C_FLAGS_RELEASE}")
endif()

set (CPACK_GENERATOR DEB)
set (CPACK_PACKAGE_NAME "libevhtp")
set (CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
set (CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_MAJOR_VERSION})
set (CPACK_PACKAGE_VERSION_MINOR ${PROJECT_MINOR_VERSION})
set (CPACK_PACKAGE_VERSION_PATCH ${PROJECT_PATCH_VERSION})

set(PROJECT_VERSION_REVISION 0)
find_program(GIT_PROGRAM git DOC "git program")
if(GIT_PROGRAM)
execute_process(
COMMAND ${GIT_PROGRAM} rev-parse --verify --short HEAD
OUTPUT_VARIABLE PROJECT_VERSION_REVISION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif(GIT_PROGRAM)

string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_PACKAGE_NAME_LOWERCASE)
find_program(DPKG_PROGRAM dpkg DOC "dpkg program of Debian-based systems")
if(DPKG_PROGRAM)
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_LOWERCASE}_${PROJECT_VERSION}-${PROJECT_VERSION_REVISION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")

else(DPKG_PROGRAM)
set(CPACK_PACKAGE_FILE_NAME
"${CPACK_PACKAGE_NAME_LOWERCASE}_${PROJECT_VERSION}-${PROJECT_VERSION_REVISION}_${CMAKE_SYSTEM_NAME}")
endif(DPKG_PROGRAM)

set (CPACK_DEBIAN_PACKAGE_MAINTAINER "unknown")
find_program(WHOAMI_PROGRAM whoami DOC "whoami program")
if(WHOAMI_PROGRAM)
execute_process(
COMMAND ${WHOAMI_PROGRAM}
OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_MAINTAINER
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif(WHOAMI_PROGRAM)
INCLUDE(CPack)

message("")

0 comments on commit 0c4a8ec

Please sign in to comment.