-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathCMakeLists.txt
49 lines (40 loc) · 1.86 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
cmake_minimum_required(VERSION 2.6)
project(ip_vs_ca C)
execute_process(COMMAND uname -r
OUTPUT_VARIABLE KERNEL_RELEASE
OUTPUT_STRIP_TRAILING_WHITESPACE)
find_path(KERNEL_SRCDIR Makefile PATHS
/lib/modules/${KERNEL_RELEASE}/source
/lib/modules/${KERNEL_RELEASE}/build)
message(STATUS "Kernel release: ${KERNEL_RELEASE}")
message(STATUS "Kernel source: ${KERNEL_SRCDIR}")
set(CPACK_GENERATOR "RPM;DEB")
set(CPACK_PACKAGE_NAME "ip_vs_ca")
set(CPACK_PACKAGE_CONTACT "[email protected]")
set(CPACK_PACKAGE_VENDOR "yubo.org")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "ip vs ca - get ip vs(fullnat) client addr")
set(CPACK_PACKAGE_VERSION "0.1.3")
set(CPACK_PACKAGE_DESCRIPTION "get ip vs(fullnat) client addr")
SET(CPACK_OUTPUT_FILE_PREFIX package)
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${KERNEL_RELEASE}-${CPACK_PACKAGE_VERSION}.${CMAKE_SYSTEM_PROCESSOR}")
set(CPACK_PACKAGE_RELOCATABLE false)
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/scripts/postinst")
set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/scripts/postinst")
set(CPACK_RPM_CHANGELOG_FILE "${CMAKE_CURRENT_BINARY_DIR}/ChangeLog")
set(CPACK_RPM_PACKAGE_LICENSE "BSD")
set(CPACK_RPM_PACKAGE_GROUP "System Environment/Kernel")
set(CPACK_RPM_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION})
set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION
"/usr"
"/lib"
"/lib/modules"
"/lib/modules/${KERNEL_RELEASE}"
"/lib/modules/${KERNEL_RELEASE}/kernel"
"/lib/modules/${KERNEL_RELEASE}/kernel/extra")
include(CPack)
add_custom_command(OUTPUT ChangeLog
COMMAND git log --format='* %cd %aN%n- (%h) %s%d%n' --date=local | sed -r 's/[0-9]+:[0-9]+:[0-9]+ //' >> ${CMAKE_CURRENT_BINARY_DIR}/ChangeLog
COMMENT "export git log to ChangeLog")
add_custom_target(PKGFILES ALL DEPENDS ChangeLog)
add_custom_target(deploy COMMAND ghr --delete ${CPACK_PACKAGE_VERSION} package)
add_subdirectory(src)