2020-07-20 16:52:23 +00:00
|
|
|
# Copyright (c) 2020 ARM Limited. All rights reserved.
|
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
2020-07-28 10:42:36 +00:00
|
|
|
# Set the default build type if none is specified
|
2020-07-28 10:13:31 +00:00
|
|
|
if(NOT CMAKE_BUILD_TYPE)
|
|
|
|
set(CMAKE_BUILD_TYPE "Develop" CACHE
|
2020-07-31 14:26:37 +00:00
|
|
|
STRING "The build type" FORCE
|
|
|
|
)
|
2020-07-28 10:13:31 +00:00
|
|
|
endif()
|
|
|
|
|
2020-07-27 07:20:16 +00:00
|
|
|
set(MBED_BUILD_TYPES Debug Release Develop)
|
|
|
|
|
|
|
|
# Force the build types to be case-insensitive for checking
|
|
|
|
set(LOWERCASE_MBED_BUILD_TYPES ${MBED_BUILD_TYPES})
|
|
|
|
list(TRANSFORM LOWERCASE_MBED_BUILD_TYPES TOLOWER)
|
|
|
|
string(TOLOWER ${CMAKE_BUILD_TYPE} LOWERCASE_CMAKE_BUILD_TYPE)
|
|
|
|
|
2020-07-31 14:26:37 +00:00
|
|
|
# Mapping CMAKE_BUILD_TYPE into MBED_BUILD_TYPES, as we understand only 3 profiles
|
2020-07-27 07:20:16 +00:00
|
|
|
get_property(multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
|
|
|
if(multi_config)
|
2020-07-28 10:42:36 +00:00
|
|
|
# Provide only a list as multi configuration generators do not support build type
|
2020-07-28 10:28:12 +00:00
|
|
|
set(CMAKE_CONFIGURATION_TYPES "${MBED_BUILD_TYPES}" CACHE STRING "List of supported build types" FORCE)
|
2020-07-27 07:20:16 +00:00
|
|
|
else()
|
2020-07-28 10:28:12 +00:00
|
|
|
# Set the possible values of build type for cmake-gui
|
|
|
|
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "${MBED_BUILD_TYPES}")
|
2020-07-28 10:42:36 +00:00
|
|
|
|
2020-07-28 10:28:12 +00:00
|
|
|
if(NOT LOWERCASE_CMAKE_BUILD_TYPE IN_LIST LOWERCASE_MBED_BUILD_TYPES)
|
|
|
|
message(FATAL_ERROR "Invalid build type '${CMAKE_BUILD_TYPE}'. Possible values:\n ${MBED_BUILD_TYPES}")
|
2020-07-28 10:42:36 +00:00
|
|
|
endif()
|
2020-07-27 07:20:16 +00:00
|
|
|
endif()
|
|
|
|
|
2020-11-05 12:22:34 +00:00
|
|
|
include(${MBED_PATH}/tools/cmake/profiles/${LOWERCASE_CMAKE_BUILD_TYPE}.cmake)
|