blob: 327f6a437ed61aab80975b9d3889a32b9a0fca88 (
plain)
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
|
include(CheckCXXSourceCompiles)
FIND_PATH(LIBPURPLE_INCLUDE_DIR purple.h
PATH_SUFFIXES include/libpurple src/libpurple
PATHS
/usr/local
/usr
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt
)
FIND_LIBRARY(LIBPURPLE_LIBRARY_RELEASE
NAMES purple libpurple libpurple-static
)
if (LIBPURPLE_LIBRARY_RELEASE)
list(APPEND LIBPURPLE_LIBRARY optimized ${LIBPURPLE_LIBRARY_RELEASE})
endif()
FIND_LIBRARY(LIBPURPLE_LIBRARY_DEBUG
NAMES purple_d libpurple_d libpurple-static_d
)
if (LIBPURPLE_LIBRARY_DEBUG)
list(APPEND LIBPURPLE_LIBRARY debug ${LIBPURPLE_LIBRARY_DEBUG})
else()
if (UNIX)
list(APPEND LIBPURPLE_LIBRARY debug ${LIBPURPLE_LIBRARY_RELEASE})
endif()
endif()
# message("LIBPURPLE_LIBRARY: ${LIBPURPLE_LIBRARY}")
# message("LIBPURPLE_INCLUDE_DIR: ${LIBPURPLE_INCLUDE_DIR}")
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBPURPLE DEFAULT_MSG LIBPURPLE_LIBRARY LIBPURPLE_INCLUDE_DIR)
# we need to check the API of libpurple, but need a couple more libraries
find_package(ICONV)
find_package(GLIB2)
find_package(GObject)
if (LIBPURPLE_FOUND AND GLIB2_FOUND AND ICONV_FOUND AND GOBJECT_FOUND)
set(CMAKE_REQUIRED_INCLUDES ${LIBPURPLE_INCLUDE_DIR} ${GLIB2_INCLUDE_DIRS} ${ICONV_INCLUDE_DIR} ${GOBJECT_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${LIBPURPLE_LIBRARY} ${GLIB2_LIBRARIES} ${ICONV_LIBRARIES} ${GOBJECT_LIBRARIES})
if (LIBPURPLE_FOUND)
check_cxx_source_compiles("
extern \"C\" {
#include <purple.h>
}
int main(){
/*
* There was a refactoring to glib datastructures,
* The PurpleRequestFeature occured at the same time.
*/
PurpleRequestFeature _features;
}
" LIBPURPLE_GLIB_DATASTRUCTS)
endif()
set(CMAKE_REQUIRED_INCLUDES)
set(CMAKE_REQUIRED_LIBRARIES)
endif()
MARK_AS_ADVANCED(LIBPURPLE_LIBRARY LIBPURPLE_INCLUDE_DIR)
|