-
Notifications
You must be signed in to change notification settings - Fork 11
/
CMakeLists.txt
74 lines (61 loc) · 4.18 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# SNMPpp: https://sourceforge.net/p/snmppp/
# SNMPpp project uses the MIT license. See LICENSE for details.
# Copyright (C) 2013 Stephane Charette <[email protected]>
PROJECT ( SNMPpp C CXX )
CMAKE_MINIMUM_REQUIRED ( VERSION 2.8 )
IF ( NOT CMAKE_BUILD_TYPE )
SET ( CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE )
ENDIF ()
EXECUTE_PROCESS ( COMMAND git describe WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} OUTPUT_VARIABLE GITVER OUTPUT_STRIP_TRAILING_WHITESPACE )
MESSAGE ( "git describe: ${GITVER}" )
IF ( GITVER STREQUAL "" OR NOT ${GITVER} MATCHES "^[0-9]+\\.[0-9]+\\.[0-9]+-[0-9]+-g[0-9a-f]+$" )
SET ( GITVER "0.0.0-0-g000000" )
MESSAGE ( STATUS "Failed to parse git revision number. Using default: ${GITVER}" )
ENDIF ()
STRING ( REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)-([0-9]+)-g([0-9a-f]+)$" "\\1" SNMPPP_VER_MAJOR ${GITVER} )
STRING ( REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)-([0-9]+)-g([0-9a-f]+)$" "\\2" SNMPPP_VER_MINOR ${GITVER} )
STRING ( REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)-([0-9]+)-g([0-9a-f]+)$" "\\3" SNMPPP_VER_PATCH ${GITVER} )
STRING ( REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)-([0-9]+)-g([0-9a-f]+)$" "\\4" SNMPPP_VER_COMMIT ${GITVER} )
STRING ( REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)-([0-9]+)-g([0-9a-f]+)$" "\\5" SNMPPP_VER_HASH ${GITVER} )
SET ( SNMPPP_VERSION "${SNMPPP_VER_MAJOR}.${SNMPPP_VER_MINOR}.${SNMPPP_VER_PATCH}-${SNMPPP_VER_COMMIT}-${SNMPPP_VER_HASH}" )
MESSAGE ( "Building ver: ${SNMPPP_VERSION}" )
ENABLE_TESTING ()
ADD_SUBDIRECTORY ( code )
ADD_SUBDIRECTORY ( doc )
INSTALL ( FILES LICENSE DESTINATION doc/SNMPpp )
SET ( CPACK_PACKAGE_VENDOR "Stephane Charette" )
SET ( CPACK_PACKAGE_CONTACT "[email protected]" )
SET ( CPACK_PACKAGE_DESCRIPTION_SUMMARY "SNMPpp C++ wrapper for net-snmp" )
SET ( CPACK_PACKAGE_DESCRIPTION "SNMPpp C++ wrapper for net-snmp http://snmppp.sourceforge.net/" )
SET ( CPACK_PACKAGE_NAME "snmppp-dev" )
SET ( CPACK_PACKAGE_VERSION ${SNMPPP_VERSION} )
SET ( CPACK_PACKAGE_VERSION_MAJOR ${SNMPPP_VER_MAJOR} )
SET ( CPACK_PACKAGE_VERSION_MINOR ${SNMPPP_VER_MINOR} )
SET ( CPACK_PACKAGE_VERSION_PATCH ${SNMPPP_VER_PATCH} )
#SET ( CPACK_PACKAGE_VERSION_PATCH "${SNMPPP_VER_PATCH}-${SNMPPP_VER_COMMIT}-${SNMPPP_VER_HASH}" )
SET ( CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE )
IF ( UNIX )
# dependencies were found by running this comand: objdump --private-headers libsnmppp.so | grep NEEDED
SET ( CPACK_DEBIAN_PACKAGE_DEPENDS "libstdc++6, libgcc1, libsnmp15, libsnmp-dev" )
SET ( CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64" )
SET ( CPACK_DEBIAN_PACKAGE_SECTION "libs" )
SET ( CPACK_DEBIAN_PACKAGE_PRIORITY "optional" )
SET ( CPACK_DEBIAN_PACKAGE_MAINTAINER "Stephane Charette <[email protected]>" )
SET ( CPACK_PACKAGE_FILE_NAME "snmppp-dev-${SNMPPP_VER_MAJOR}.${SNMPPP_VER_MINOR}.${SNMPPP_VER_PATCH}-${SNMPPP_VER_COMMIT}_Linux-${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}" )
SET ( CPACK_GENERATOR "DEB;RPM" )
ELSE ()
SET ( CPACK_PACKAGE_FILE_NAME "snmppp-dev-${SNMPPP_VER_MAJOR}.${SNMPPP_VER_MINOR}.${SNMPPP_VER_PATCH}-${SNMPPP_VER_COMMIT}_Win32" )
SET ( CPACK_STRIP_FILES "TRUE" )
SET ( CPACK_PACKAGE_INSTALL_DIRECTORY "SNMPpp" )
SET ( CPACK_NSIS_PACKAGE_NAME "SNMPpp" )
SET ( CPACK_NSIS_DISPLAY_NAME "SNMPpp" )
SET ( CPACK_NSIS_MUI_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\doc\\\\images\\\\snmppp.ico" )
SET ( CPACK_NSIS_MUI_UNIICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\doc\\\\images\\\\snmppp.ico" )
SET ( CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\doc\\\\images\\\\snmppp.ico" )
SET ( CPACK_NSIS_CONTACT "[email protected]" )
SET ( CPACK_NSIS_MODIFY_PATH "OFF" )
SET ( CPACK_GENERATOR "NSIS" )
ENDIF ()
SET ( CPACK_SOURCE_IGNORE_FILES ".git" ".kdev4" "SNMPpp.kdev4" "build" "snmppp.xcf" "snmppp.png" )
SET ( CPACK_SOURCE_GENERATOR "TGZ" )
INCLUDE( CPack )