Simplify how versioning is handled in both builds
[centerim5.git] / CMakeLists.txt
blobf954164892bdc03051ce54c749d45c2fae8a223f
1 project(centerim5)
3 # CMAKE_CXX_STANDARD requires at least CMake 3.1.
4 cmake_minimum_required(VERSION 3.1)
6 # C++ code requires C++11.
7 set(CMAKE_CXX_STANDARD 11)
8 set(CMAKE_CXX_EXTENSIONS false)
9 set(CMAKE_CXX_STANDARD_REQUIRED true)
11 # Libtermkey requires C99.
12 set(CMAKE_C_STANDARD 99)
13 set(CMAKE_C_EXTENSIONS false)
14 set(CMAKE_C_STANDARD_REQUIRED true)
16 # Find required libraries.
17 find_package(PkgConfig)
18 pkg_check_modules(PURPLE REQUIRED "purple >= 2.9.0")
19 pkg_check_modules(GLIB2 REQUIRED "glib-2.0 >= 2.32.0")
20 pkg_check_modules(SIGC REQUIRED "sigc++-2.0 >= 2.2.0")
21 pkg_check_modules(NCURSESW REQUIRED "ncursesw >= 5.8")
23 # Populate common include directories.
24 include_directories(
25   "${centerim5_BINARY_DIR}"
26   "${centerim5_SOURCE_DIR}")
28 # Handle translations.
29 find_package(Gettext)
30 mark_as_advanced(GETTEXT_MSGFMT_EXECUTABLE)
31 mark_as_advanced(GETTEXT_MSGMERGE_EXECUTABLE)
33 if(GETTEXT_FOUND)
34   set(centerim5_LOCALEDIR "${CMAKE_INSTALL_PREFIX}/share/locale")
35   set(ENABLE_NLS true)
36 else()
37   message(SEND_ERROR "Gettext not found, translation not possible")
38   set(ENABLE_NLS false)
39 endif()
41 # Produce documentation.
42 find_package(Doxygen)
44 # Checks for tools needed by the termex test framework. Only warn about these
45 # missing dependencies.
46 find_program(TIC_EXECUTABLE tic DOC "Path to a program.")
47 mark_as_advanced(TIC_EXECUTABLE)
48 if(TIC_EXECUTABLE)
49   message(STATUS "Found tic: ${TIC_EXECUTABLE}")
50 else()
51   message(WARNING "tic was not found, running tests will not be possible")
52 endif()
54 find_package(PythonInterp 3.5 QUIET)
55 if(PYTHONINTERP_FOUND)
56   message(STATUS
57     "Found Python 3: ${PYTHON_EXECUTABLE} (found version \"${PYTHON_VERSION_STRING}\")")
58 else()
59   message(WARNING
60     "python >= 3.5 was not found, running tests will not be possible")
61 endif()
63 if(TIC_EXECUTABLE AND PYTHONINTERP_FOUND)
64   set(TERMEX_TESTS true)
65 else()
66   set(TERMEX_TESTS false)
67 endif()
69 # Generate the config file.
70 set(centerim5_PKGLIBDIR "${CMAKE_INSTALL_PREFIX}/lib/centerim5")
71 execute_process(COMMAND misc/git-version-gen .tarball-version
72   WORKING_DIRECTORY "${centerim5_SOURCE_DIR}" OUTPUT_VARIABLE centerim5_VERSION)
73 configure_file(config.h.cmake config.h)
75 install(FILES centerim5.1 DESTINATION share/man/man1)
77 add_subdirectory(cppconsui)
78 add_subdirectory(src)
79 add_subdirectory(tests EXCLUDE_FROM_ALL)
80 add_subdirectory(plugins)
81 add_subdirectory(po)
82 add_subdirectory(doc)