-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathCMakeLists.txt
57 lines (48 loc) · 1.74 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
cmake_minimum_required(VERSION 3.16)
# Detect if RKH is being bundled
if (NOT DEFINED PROJECT_NAME)
set(NOT_SUBPROJECT BOOL TRUE "RKH is not being bundled")
endif()
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
message(FATAL_ERROR "Do not build in-source. Please remove CMakeCache.txt"
"and the CMakeFiles/ directory. Then build out-of-source.")
endif()
project(rkh LANGUAGES C)
# Custom module and scripts
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
if (NOT_SUBPROJECT)
include(boilerplate)
include(version)
set(GENERATED_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated")
configure_file(${RKH_BASE}/cmake/rkhfwk_version.h.in
${GENERATED_DIR}/rkhfwk_version.h)
file(COPY ${GENERATED_DIR}/rkhfwk_version.h
DESTINATION ${RKH_BASE}/source/fwk/inc)
endif()
# Set environment to develop the RKH framework, if it is needed
set(RKH_PLATFORM "__LNXGNU__" CACHE STRING "Selects the RKH platform")
option(RKH_DEV_BUILD
"Set to ON to enable RKH development on Linux platform" OFF)
if (RKH_DEV_BUILD)
if (NOT RKH_PLATFORM STREQUAL "__LNXGNU__")
message(FATAL_ERROR "Set RKH_PLATFORM to \"__LNXGNU__\" if you want to "
"enable RKH_DEV_BUILD")
else()
set(DEV_BUILD ON CACHE BOOL "RKH development platform is enabled")
endif()
endif()
# Print fundamental variables and options
cmake_print_variables(RKH_BASE)
cmake_print_variables(RKH_PLATFORM)
cmake_print_variables(DEV_BUILD)
cmake_print_variables(NOT_SUBPROJECT)
# We need to bring-in the variables defined there to this scope
add_subdirectory(source)
# Generate documentation
if (NOT_SUBPROJECT)
add_subdirectory(doc)
endif()
# Run unit tests
if (NOT_SUBPROJECT)
include(unittest)
endif()