24 find_package(PkgConfig REQUIRED) |
24 find_package(PkgConfig REQUIRED) |
25 pkg_check_modules(GLIB REQUIRED glib-2.0) |
25 pkg_check_modules(GLIB REQUIRED glib-2.0) |
26 pkg_check_modules(GMODULE REQUIRED gmodule-2.0) |
26 pkg_check_modules(GMODULE REQUIRED gmodule-2.0) |
27 pkg_check_modules(LM REQUIRED loudmouth-1.0) |
27 pkg_check_modules(LM REQUIRED loudmouth-1.0) |
28 pkg_check_modules(PNG REQUIRED libpng12) |
28 pkg_check_modules(PNG REQUIRED libpng12) |
|
29 pkg_check_modules(MCABBER REQUIRED mcabber) |
29 set(AALIB_LIBRARY_DIRS "/usr/lib" CACHE FILEPATH "Path, where AAlib is located") |
30 set(AALIB_LIBRARY_DIRS "/usr/lib" CACHE FILEPATH "Path, where AAlib is located") |
30 set(AALIB_INCLUDE_DIRS "/usr/include" CACHE FILEPATH "Path to AAlib includes") |
31 set(AALIB_INCLUDE_DIRS "/usr/include" CACHE FILEPATH "Path to AAlib includes") |
31 set(AALIB_LIBRARIES "-laa" CACHE TEXT "Libraries, necessary to link with AAlib") |
32 set(AALIB_LIBRARIES "-laa" CACHE TEXT "Libraries, necessary to link with AAlib") |
32 find_program(GREP_EXECUTABLE grep DOC "Grep binary to detect functions in headers") |
33 include(CheckIncludeFile) |
33 if(GREP_EXECUTABLE) |
34 set(CMAKE_REQUIRED_INCLUDES ${MCABBER_INCLUDE_DIRS}) |
34 execute_process(COMMAND ${GREP_EXECUTABLE} xmpp_is_online ${MCABBER_INCLUDE_DIR}/mcabber/xmpp.h OUTPUT_VARIABLE HAVE_XMPP_IS_ONLINE ERROR_QUIET) |
35 check_include_file(mcabber/pep.h HAVE_MCABBER_PEP_H) |
|
36 if(NOT HAVE_MCABBER_PEP_H) |
|
37 message(SEND_ERROR "Pep module header not found") |
35 endif() |
38 endif() |
36 include(CheckSymbolExists) |
39 include(CheckSymbolExists) |
37 set(CMAKE_REQUIRED_INCLUDES ${LM_INCLUDE_DIRS}) |
40 set(CMAKE_REQUIRED_INCLUDES ${LM_INCLUDE_DIRS}) |
38 set(CMAKE_REQUIRED_LIBRARIES ${LM_LIBRARIES}) |
41 set(CMAKE_REQUIRED_LIBRARIES ${LM_LIBRARIES}) |
39 set(CMAKE_REQUIRED_FLAGS ${LM_LDFLAGS} ${LM_CFLAGS}) |
42 set(CMAKE_REQUIRED_FLAGS ${LM_LDFLAGS} ${LM_CFLAGS}) |
40 check_symbol_exists(lm_connection_unregister_reply_handler loudmouth/loudmouth.h HAVE_LM_CONNECTION_UNREGISTER_REPLY_HANDLER) |
43 check_symbol_exists(lm_connection_unregister_reply_handler loudmouth/loudmouth.h HAVE_LM_CONNECTION_UNREGISTER_REPLY_HANDLER) |
41 link_directories(${GLIB_LIBRARY_DIRS} |
44 link_directories(${GLIB_LIBRARY_DIRS} |
42 ${GMODULE_LIBRARY_DIRS} |
45 ${GMODULE_LIBRARY_DIRS} |
43 ${LM_LIBRARY_DIRS} |
46 ${LM_LIBRARY_DIRS} |
44 ${PNG_LIBRARY_DIRS} |
47 ${PNG_LIBRARY_DIRS} |
45 ${AALIB_LIBRARY_DIRS}) |
48 ${AALIB_LIBRARY_DIRS} |
|
49 ${MCABBER_LIBRARY_DIRS}) |
46 |
50 |
47 ## Target definitions |
51 ## Target definitions |
48 add_library(avatar MODULE avatar.c) |
52 add_library(avatar MODULE avatar.c) |
49 |
53 |
50 ## Compiler setup |
54 ## Compiler setup |
52 include_directories(SYSTEM ${GLIB_INCLUDE_DIRS} |
56 include_directories(SYSTEM ${GLIB_INCLUDE_DIRS} |
53 ${GMODULE_INCLUDE_DIRS} |
57 ${GMODULE_INCLUDE_DIRS} |
54 ${LM_INCLUDE_DIRS} |
58 ${LM_INCLUDE_DIRS} |
55 ${PNG_INCLUDE_DIRS} |
59 ${PNG_INCLUDE_DIRS} |
56 ${AALIB_INCLUDE_DIRS} |
60 ${AALIB_INCLUDE_DIRS} |
57 ${MCABBER_INCLUDE_DIR}) |
61 ${MCABBER_INCLUDE_DIRS}) |
58 target_link_libraries(avatar ${GLIB_LIBRARIES} |
62 target_link_libraries(avatar ${GLIB_LIBRARIES} |
59 ${GMODULE_LIBRARIES} |
63 ${GMODULE_LIBRARIES} |
60 ${LM_LIBRARIES} |
64 ${LM_LIBRARIES} |
61 ${PNG_LIBRARIES} |
65 ${PNG_LIBRARIES} |
62 ${AALIB_LIBRARIES}) |
66 ${AALIB_LIBRARIES} |
|
67 ${MCABBER_LIBRARIES}) |
63 include_directories(${avatar_SOURCE_DIR} |
68 include_directories(${avatar_SOURCE_DIR} |
64 ${avatar_BINARY_DIR}) |
69 ${avatar_BINARY_DIR}) |
65 |
70 |
66 ## Packaging information |
71 ## Packaging information |
67 set(CPACK_PACKAGE_NAME libmcabber-avatar) |
72 set(CPACK_PACKAGE_NAME libmcabber-avatar) |