-
Notifications
You must be signed in to change notification settings - Fork 12
/
CMakeLists.txt
40 lines (36 loc) · 1.58 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
# CMake 3.19 is the first to include presets
# (https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html)
cmake_minimum_required(VERSION 3.19)
project("OpentronsModules"
LANGUAGES CXX C ASM
DESCRIPTION "Firmware for Opentrons modules")
set(CMAKE_MODULE_PATH
"${PROJECT_SOURCE_DIR}/cmake"
"${PROJECT_SOURCE_DIR}/cmake/codecov/cmake"
${CMAKE_MODULE_PATH})
if (NOT ${CMAKE_CROSSCOMPILING})
enable_testing()
add_custom_target(build-and-test)
endif()
# These subdirectories contain the code for these modules and the
# CMakeLists for them. The MODULE_TYPE variable is set in the arduino preset.
if (${MODULE_TYPE} STREQUAL "arduino")
add_subdirectory(arduino-modules)
elseif (${MODULE_TYPE} STREQUAL "stm32")
# Set a default build type if none was specified
# From https://blog.kitware.com/cmake-and-the-default-build-type/
# MinSizeRel is the default release type since the binary size is quite important.
set(default_build_type "RelWithDebInfo")
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "MinSizeRel" "RelWithDebInfo")
endif()
message("Build type is ${CMAKE_BUILD_TYPE}")
add_subdirectory(stm32-modules)
else()
message(FATAL_ERROR "Module type ${MODULE_TYPE} is not set or unknown, use a preset or -DMODULE_TYPE")
endif()