forked from smartnode/telebot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
54 lines (44 loc) · 1.69 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
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(telebot C)
SET(PROJECT_DESCRIPTION "Telegram Bot API")
SET(PREFIX ${CMAKE_INSTALL_PREFIX})
SET(EXEC_PREFIX "${PREFIX}/bin")
SET(INCLUDEDIR "${PREFIX}/include/${PROJECT_NAME}")
SET(LIBDIR "${PREFIX}/lib")
SET(VERSION 4.7.0)
SET(CMAKE_MACOSX_RPATH 1)
SET(SRCS
src/telebot-parser.c
src/telebot-core.c
src/telebot.c
)
ADD_DEFINITIONS("-DDEBUG=1")
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
SET(DEPENDENTS "libcurl json-c")
INCLUDE(FindPkgConfig)
pkg_check_modules(PKGS REQUIRED ${DEPENDENTS})
FOREACH(flag ${PKGS_CFLAGS})
SET(EXTRA_LIB_CFLAGS "${EXTRA_LIB_CFLAGS} ${flag}")
ENDFOREACH(flag)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_LIB_CFLAGS} -Werror -Wall -Wno-unused-function" )
# libtelebot
ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})
ADD_LIBRARY(${PROJECT_NAME}_static STATIC ${SRCS})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${PKGS_LDFLAGS})
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION})
# package configuration
CONFIGURE_FILE(telebot.pc.in telebot.pc @ONLY)
# echobot (test)
ADD_SUBDIRECTORY(test)
# CMake Policy (CMP0002)
# The logical name of executable and library targets
# does not have to correspond to the physical file name built.
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/telebot.pc DESTINATION lib/pkgconfig)
INSTALL(TARGETS ${PROJECT_NAME} DESTINATION lib COMPONENT RuntimeLibraries)
INSTALL(FILES
${CMAKE_CURRENT_SOURCE_DIR}/include/telebot.h
${CMAKE_CURRENT_SOURCE_DIR}/include/telebot-common.h
${CMAKE_CURRENT_SOURCE_DIR}/include/telebot-methods.h
${CMAKE_CURRENT_SOURCE_DIR}/include/telebot-types.h
${CMAKE_CURRENT_SOURCE_DIR}/include/telebot-core.h
DESTINATION include/telebot/)