Update list of wide characters
[centerim5.git] / CMakeLists.txt
blob7ee9bd495d0b97ec19a34737e2f972c64e0075e3
1 # CMAKE_CXX_STANDARD requires at least CMake 3.1.
2 cmake_minimum_required(VERSION 3.1)
4 project(centerim5)
5 enable_testing()
7 set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
9 # C++ code requires C++11.
10 set(CMAKE_CXX_STANDARD 11)
11 set(CMAKE_CXX_EXTENSIONS false)
12 set(CMAKE_CXX_STANDARD_REQUIRED true)
14 # The extaction plugin requires C99.
15 set(CMAKE_C_STANDARD 99)
16 set(CMAKE_C_EXTENSIONS false)
17 set(CMAKE_C_STANDARD_REQUIRED true)
19 # Find required libraries.
20 find_package(PkgConfig)
21 pkg_check_modules(PURPLE REQUIRED "purple >= 2.9.0")
22 pkg_check_modules(GLIB2 REQUIRED "glib-2.0 >= 2.32.0")
23 pkg_check_modules(SIGC REQUIRED "sigc++-2.0 >= 2.2.0")
24 pkg_check_modules(NCURSESW REQUIRED "ncursesw >= 5.8")
25 pkg_check_modules(TERMKEY REQUIRED "termkey >= 0.18")
27 # Populate common include directories.
28 include_directories(
29   "${CMAKE_CURRENT_BINARY_DIR}"
30   "${CMAKE_CURRENT_SOURCE_DIR}")
32 # Handle localization.
33 find_package(Iconv)
34 if(NOT Iconv_FOUND)
35   message(SEND_ERROR "Iconv not found")
36 endif()
38 find_package(Intl)
39 find_package(Gettext)
40 mark_as_advanced(GETTEXT_MSGFMT_EXECUTABLE)
41 mark_as_advanced(GETTEXT_MSGMERGE_EXECUTABLE)
43 if(Intl_FOUND AND GETTEXT_FOUND)
44   set(centerim5_LOCALEDIR "${CMAKE_INSTALL_PREFIX}/share/locale")
45   set(ENABLE_NLS true)
46 else()
47   if(NOT Intl_FOUND AND NOT GETTEXT_FOUND)
48     set(missing_package "Intl and Gettext")
49   elseif(NOT Intl_FOUND)
50     set(missing_package "Intl")
51   else()
52     set(missing_package "Gettext")
53   endif()
54   message(SEND_ERROR "${missing_package} not found, localization not possible")
55   set(ENABLE_NLS false)
56 endif()
58 # Produce documentation.
59 find_package(Doxygen)
60 if(NOT DOXYGEN_FOUND)
61   message(WARNING
62     "Doxygen was not found, generating documentation for CppConsUI will not be "
63     "possible")
64 endif()
65 if(NOT DOXYGEN_DOT_FOUND)
66   message(WARNING
67     "Dot was not found, generating documentation for CppConsUI will not be "
68     "possible")
69 endif()
71 # Checks for tools needed by the termex test framework. Only warn about these
72 # missing dependencies.
73 find_program(TIC_EXECUTABLE tic DOC "Path to a program.")
74 mark_as_advanced(TIC_EXECUTABLE)
75 find_package_handle_standard_args(Tic
76   REQUIRED_VARS TIC_EXECUTABLE)
77 if(NOT TIC_EXECUTABLE)
78   message(WARNING "Tic was not found, running tests will not be possible")
79 endif()
81 find_package(PythonInterp 3.5)
82 if(NOT PYTHONINTERP_FOUND)
83   message(WARNING
84     "Suitable Python interpreter was not found, running tests will not be "
85     "possible")
86 endif()
88 if(TIC_EXECUTABLE AND PYTHONINTERP_FOUND)
89   set(TERMEX_TESTS true)
90 else()
91   set(TERMEX_TESTS false)
92 endif()
94 # Generate the config file.
95 set(centerim5_PKGLIBDIR "${CMAKE_INSTALL_PREFIX}/lib/centerim5")
96 execute_process(COMMAND misc/git-version-gen .tarball-version
97   WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
98   OUTPUT_VARIABLE centerim5_VERSION)
99 configure_file(config.h.cmake config.h)
101 install(FILES centerim5.1 DESTINATION share/man/man1)
103 add_subdirectory(cppconsui)
104 add_subdirectory(src)
105 add_subdirectory(tests EXCLUDE_FROM_ALL)
106 add_subdirectory(plugins)
107 add_subdirectory(po)
108 add_subdirectory(doc)