-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCMakeLists.txt
88 lines (71 loc) · 3.19 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
cmake_minimum_required(VERSION 3.15.0)
# Just simply do not let the user do this, because this litters the project
# tree with weird contents that are not verbosely elaborated in a .gitignore...
set(CMAKE_DISABLE_SOURCE_CHANGES ON)
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
file(REMOVE "CMakeCache.txt")
file(REMOVE_RECURSE "CMakeFiles")
message(FATAL_ERROR "Raw in-tree builds are not supported, please use a dedicated 'Build' directory!"
"\nDue to technical detail, 'CMakeCache.txt' and 'CMakeFiles/' will still be created as trash in your directory now, and you should remove them!")
endif()
list(APPEND CMAKE_MODULE_PATH
"${CMAKE_SOURCE_DIR}/cmake"
)
include(MonomuxVersion)
project(monomux
LANGUAGES CXX
VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.${VERSION_TWEAK}
DESCRIPTION "MonoMux: Monophone Terminal Multiplexer"
HOMEPAGE_URL "http://github.com/whisperity/MonoMux")
if (NOT UNIX)
message(FATAL_ERROR "This project supports only POSIX Unix/Linux platforms!")
endif()
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug)
endif()
include(GNUInstallDirs)
include(MonomuxConfig)
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "Monomux")
# Support adding compiler diagnostic flags dynamically, based on whether the
# compiler supports them.
include(CheckCXXCompilerFlag)
function(check_add_compile_option OPT)
# Create an output variable for check_cxx_compiler_flag().
string(REGEX REPLACE "^[-/]" "" var ${OPT})
string(REGEX REPLACE ":" "" var ${var})
check_cxx_compiler_flag(${OPT} ${var})
if (${var})
add_compile_options(${OPT})
else()
message(STATUS "Skip unsupported ${OPT} with the current compiler.")
endif()
endfunction()
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if ( (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") )
check_add_compile_option(-Wall)
check_add_compile_option(-Wextra)
endif()
message(STATUS "- * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - ")
message(STATUS " MonoMux (v${MONOMUX_VERSION_STRING})")
message(STATUS "------------------------------------------------------------------------------")
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
message(STATUS "System: ${CMAKE_SYSTEM_PROCESSOR} (${CMAKE_SYSTEM_NAME})")
message(STATUS "C++ standard: C++${CMAKE_CXX_STANDARD}")
message(STATUS "Library type: ${MONOMUX_LIBRARY_TYPE}")
message(STATUS "Non-essential log output: ${MONOMUX_NON_ESSENTIAL_LOGS}")
message(STATUS "- * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - ")
# TODO: Add -UNDEBUG so #ifndef NDEBUG and asserts are there for RelWithDebInfo.
include_directories(
"${CMAKE_SOURCE_DIR}/include/core"
"${CMAKE_SOURCE_DIR}/include/implementation"
"${CMAKE_BINARY_DIR}/include"
)
add_subdirectory(include)
add_subdirectory(src)
include(MonomuxDoxygen)
include(MonomuxCPack)
add_subdirectory(test)