-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
97 lines (73 loc) · 2.92 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
89
90
91
92
93
94
95
96
97
cmake_minimum_required(VERSION 3.12)
project(QAPI-IDE)
message(STATUS "Building on: ${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_VERSION}")
# Project configurations
set(CMAKE_CONFIGURATION_TYPES Debug Release RelWithDebInfo)
# Use project folders in IDE's
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Meta and Helper Modules
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}"
"${PROJECT_SOURCE_DIR}/CMake/Modules"
"${PROJECT_SOURCE_DIR}/CMake/Libs")
# Set C++ standard macro
include(SetCppStandard)
# Target creation macro
include(CreateTarget)
# Folder where generated files go
set(GENERATED_DIR ${CMAKE_CURRENT_BINARY_DIR}/Generated)
include_directories(${GENERATED_DIR})
# Handle configuration types
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Set the CMake configuration type to use")
message(STATUS "Using configuration type: ${CMAKE_BUILD_TYPE}")
set(CMAKE_CONFIGURATION_TYPES ${CMAKE_BUILD_TYPE})
# Position Independent Code
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# Shared Libraries Configuration
set(CMAKE_INSTALL_RPATH "${ORIGIN}")
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
# Enable (strict) C++17 features
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# Release mode flags
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -DNDEBUG")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O2 -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -rpath -fPIC")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -rpath -fPIC")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wno-unused-command-line-argument")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Wno-unused-command-line-argument")
# Generic flags
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unknown-pragmas -Wno-switch")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unknown-pragmas -Wno-switch")
# Debug mode flags
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
message(STATUS "Building with development configuration.")
add_definitions(-DDEBUG_BUILD)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
message(STATUS "LLVM/clang detected. Enabling LLDB debugger tuning...")
add_definitions("-glldb")
endif()
endif()
# Set target destination for built targets
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib-static)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
# Dependencies
add_subdirectory(Libs)
# Targets
add_subdirectory(Utils)
add_subdirectory(Logger)
add_subdirectory(RequestLib)
add_subdirectory(MarkupFormatLib)
add_subdirectory(WorkspaceFormat)
option(ENABLE_SCRIPTING "Build with scripting support" OFF)
if (ENABLE_SCRIPTING)
message(STATUS "Scripting support enabled.")
add_subdirectory(ScriptingInterface)
endif()
add_subdirectory(UserInterface)
option(ENABLE_TESTS "Build the unit tests" ON)
if (ENABLE_TESTS)
message(STATUS "Unit tests enabled.")
add_subdirectory(Tests)
endif()