16 |
16 |
17 cmake_minimum_required(VERSION 2.6) |
17 cmake_minimum_required(VERSION 2.6) |
18 project(disco C) |
18 project(disco C) |
19 |
19 |
20 ## User settable options |
20 ## User settable options |
21 set(MCABBER_INCLUDE_DIR "/usr/include" CACHE FILEPATH "Path to mcabber headers") |
|
22 |
21 |
23 ## Check for build dependencies |
22 ## Check for build dependencies |
24 find_package(PkgConfig REQUIRED) |
23 find_package(PkgConfig REQUIRED) |
25 pkg_check_modules(GLIB REQUIRED glib-2.0) |
24 pkg_check_modules(GLIB REQUIRED glib-2.0) |
26 pkg_check_modules(GMODULE REQUIRED gmodule-2.0) |
25 pkg_check_modules(GMODULE REQUIRED gmodule-2.0) |
27 pkg_check_modules(LM REQUIRED loudmouth-1.0) |
26 pkg_check_modules(LM REQUIRED loudmouth-1.0) |
28 find_program(GREP_EXECUTABLE grep DOC "Grep binary to detect functions in headers") |
27 pkg_check_modules(MCABBER REQUIRED mcabber) |
29 if(GREP_EXECUTABLE) |
|
30 execute_process(COMMAND ${GREP_EXECUTABLE} xmpp_is_online ${MCABBER_INCLUDE_DIR}/mcabber/xmpp.h OUTPUT_VARIABLE HAVE_XMPP_IS_ONLINE ERROR_QUIET) |
|
31 endif() |
|
32 include(CheckSymbolExists) |
28 include(CheckSymbolExists) |
33 set(CMAKE_REQUIRED_INCLUDES ${LM_INCLUDE_DIRS}) |
29 set(CMAKE_REQUIRED_INCLUDES ${LM_INCLUDE_DIRS}) |
34 set(CMAKE_REQUIRED_LIBRARIES ${LM_LIBRARIES}) |
30 set(CMAKE_REQUIRED_LIBRARIES ${LM_LIBRARIES}) |
35 set(CMAKE_REQUIRED_FLAGS ${LM_LDFLAGS} ${LM_CFLAGS}) |
31 set(CMAKE_REQUIRED_FLAGS ${LM_LDFLAGS} ${LM_CFLAGS}) |
36 check_symbol_exists(lm_connection_unregister_reply_handler loudmouth/loudmouth.h HAVE_LM_CONNECTION_UNREGISTER_REPLY_HANDLER) |
32 check_symbol_exists(lm_connection_unregister_reply_handler loudmouth/loudmouth.h HAVE_LM_CONNECTION_UNREGISTER_REPLY_HANDLER) |
37 link_directories(${GLIB_LIBRARY_DIRS} |
33 link_directories(${GLIB_LIBRARY_DIRS} |
38 ${GMODULE_LIBRARY_DIRS} |
34 ${GMODULE_LIBRARY_DIRS} |
39 ${LM_LIBRARY_DIRS}) |
35 ${LM_LIBRARY_DIRS} |
|
36 ${MCABBER_LIBRARY_DIRS}) |
40 |
37 |
41 ## Target definitions |
38 ## Target definitions |
42 add_library(disco MODULE disco.c) |
39 add_library(disco MODULE disco.c) |
43 |
40 |
44 ## Compiler setup |
41 ## Compiler setup |
45 configure_file(config.h.in config.h) |
42 configure_file(config.h.in config.h) |
46 include_directories(SYSTEM ${GLIB_INCLUDE_DIRS} |
43 include_directories(SYSTEM ${GLIB_INCLUDE_DIRS} |
47 ${GMODULE_INCLUDE_DIRS} |
44 ${GMODULE_INCLUDE_DIRS} |
48 ${LM_INCLUDE_DIRS} |
45 ${LM_INCLUDE_DIRS} |
49 ${MCABBER_INCLUDE_DIR}) |
46 ${MCABBER_INCLUDE_DIRS}) |
50 target_link_libraries(disco ${GLIB_LIBRARIES} |
47 target_link_libraries(disco ${GLIB_LIBRARIES} |
51 ${GMODULE_LIBRARIES} |
48 ${GMODULE_LIBRARIES} |
52 ${LM_LIBRARIES}) |
49 ${LM_LIBRARIES} |
|
50 ${MCABBER_LIBRARIES}) |
53 include_directories(${disco_SOURCE_DIR} |
51 include_directories(${disco_SOURCE_DIR} |
54 ${disco_BINARY_DIR}) |
52 ${disco_BINARY_DIR}) |
55 |
53 |
56 ## Packaging information |
54 ## Packaging information |
57 set(CPACK_PACKAGE_NAME libmcabber-disco) |
55 set(CPACK_PACKAGE_NAME libmcabber-disco) |