Minor cleanup in ViewPort::addLineChar()
[centerim5.git] / CMakeLists.txt
blobadc1792b97cbc505aeae0a0035c382692575feff
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 # Libtermkey 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")
26 # Populate common include directories.
27 include_directories(
28   "${CMAKE_CURRENT_BINARY_DIR}"
29   "${CMAKE_CURRENT_SOURCE_DIR}")
31 # Handle localization.
32 find_package(Iconv)
33 if(NOT Iconv_FOUND)
34   message(SEND_ERROR "Iconv not found")
35 endif()
37 find_package(Intl)
38 find_package(Gettext)
39 mark_as_advanced(GETTEXT_MSGFMT_EXECUTABLE)
40 mark_as_advanced(GETTEXT_MSGMERGE_EXECUTABLE)
42 if(Intl_FOUND AND GETTEXT_FOUND)
43   set(centerim5_LOCALEDIR "${CMAKE_INSTALL_PREFIX}/share/locale")
44   set(ENABLE_NLS true)
45 else()
46   if(NOT Intl_FOUND AND NOT GETTEXT_FOUND)
47     set(missing_package "Intl and Gettext")
48   elseif(NOT Intl_FOUND)
49     set(missing_package "Intl")
50   else()
51     set(missing_package "Gettext")
52   endif()
53   message(SEND_ERROR "${missing_package} not found, localization not possible")
54   set(ENABLE_NLS false)
55 endif()
57 # Produce documentation.
58 find_package(Doxygen)
59 if(NOT DOXYGEN_FOUND)
60   message(WARNING
61     "Doxygen was not found, generating documentation for CppConsUI will not be "
62     "possible")
63 endif()
64 if(NOT DOXYGEN_DOT_FOUND)
65   message(WARNING
66     "Dot was not found, generating documentation for CppConsUI will not be "
67     "possible")
68 endif()
70 # Checks for tools needed by the termex test framework. Only warn about these
71 # missing dependencies.
72 find_program(TIC_EXECUTABLE tic DOC "Path to a program.")
73 mark_as_advanced(TIC_EXECUTABLE)
74 find_package_handle_standard_args(Tic
75   REQUIRED_VARS TIC_EXECUTABLE)
76 if(NOT TIC_EXECUTABLE)
77   message(WARNING "Tic was not found, running tests will not be possible")
78 endif()
80 find_package(PythonInterp 3.5)
81 if(NOT PYTHONINTERP_FOUND)
82   message(WARNING
83     "Suitable Python interpreter was not found, running tests will not be "
84     "possible")
85 endif()
87 if(TIC_EXECUTABLE AND PYTHONINTERP_FOUND)
88   set(TERMEX_TESTS true)
89 else()
90   set(TERMEX_TESTS false)
91 endif()
93 # Generate the config file.
94 set(centerim5_PKGLIBDIR "${CMAKE_INSTALL_PREFIX}/lib/centerim5")
95 execute_process(COMMAND misc/git-version-gen .tarball-version
96   WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
97   OUTPUT_VARIABLE centerim5_VERSION)
98 configure_file(config.h.cmake config.h)
100 install(FILES centerim5.1 DESTINATION share/man/man1)
102 add_subdirectory(cppconsui)
103 add_subdirectory(src)
104 add_subdirectory(tests EXCLUDE_FROM_ALL)
105 add_subdirectory(plugins)
106 add_subdirectory(po)
107 add_subdirectory(doc)