-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
72 lines (57 loc) · 2.09 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
cmake_minimum_required (VERSION 3.12)
project (fchat)
#add_library(fchat src/fchat.c)
set (fchat_VERSION_MAJOR 1)
set (fchat_VERSION_MINOR 2)
# Set global compiler-specific flags
if("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wshadow -fvisibility=hidden -std=c11")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -ggdb")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -ggdb")
endif()
include(FindPkgConfig)
pkg_check_modules(GLIB REQUIRED glib-2.0)
pkg_check_modules(GIO REQUIRED gio-2.0)
include_directories(${GIO_INCLUDE_DIRS})
add_definitions(${GIO_CFLAGS_OTHER})
link_directories(${GIO_LIBRARY_DIRS})
list(APPEND EXTRA_LIBRARIES ${GIO_LIBRARIES})
# Libpurple
add_definitions(-DPURPLE_PLUGINS)
pkg_check_modules(PURPLE REQUIRED purple)
include_directories(${PURPLE_INCLUDE_DIRS})
add_definitions(${PURPLE_CFLAGS_OTHER})
link_directories(${PURPLE_LIBRARY_DIRS})
list(APPEND EXTRA_LIBRARIES ${PURPLE_LIBRARIES})
# Store path to libpurple plugins directory for later install() command.
if (UNIX AND NOT APPLE)
execute_process(COMMAND pkg-config purple --variable=plugindir
OUTPUT_VARIABLE PURPLE_PLUGIN_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
include_directories(src)
set(SOURCES
src/actions.c
src/attention.c
src/buddy.c
src/chat.c
src/connection.c
src/fchat.c
src/fchat.h
src/info.c
src/process_cmds.c
src/send_cmds.c
src/status.c
)
# Primary plugin library.
add_library(${PROJECT_NAME} SHARED ${SOURCES})
target_link_libraries(${PROJECT_NAME} ${EXTRA_LIBRARIES})
# Install target for Linux (not tested on BSD)
if(UNIX AND NOT APPLE)
# Default install prefix is /usr/local, change it to /usr
if(NOT DEFINED CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "/usr")
endif()
install(TARGETS ${PROJECT_NAME} DESTINATION ${PURPLE_PLUGIN_DIR})
install(DIRECTORY "share/pixmaps/pidgin/protocols" DESTINATION "share/pixmaps/pidgin")
endif()