CMake build type: set default Develop profile

Adding also comments for multiconfig/property set.
pull/13566/head
Martin Kojtal 2020-07-28 11:13:31 +01:00 committed by Hugues Kamba
parent 4f8568cd8e
commit 2f89e99ee4
1 changed files with 8 additions and 0 deletions

View File

@ -1,6 +1,12 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
# Set Develop as our default type if no other selected
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Develop" CACHE
STRING "The type of build" FORCE)
endif()
# Mapping CMAKE_BUILD_TYPE into MBED_BUILD_TYPES, as we understand only 3 profiles
set(MBED_BUILD_TYPES Debug Release Develop)
@ -11,8 +17,10 @@ string(TOLOWER ${CMAKE_BUILD_TYPE} LOWERCASE_CMAKE_BUILD_TYPE)
get_property(multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(multi_config)
# multi configuration generators do not support build type, providing a list only
set(CMAKE_CONFIGURATION_TYPES "${MBED_BUILD_TYPES}" CACHE STRING "List of supported build types" FORCE)
else()
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "${MBED_BUILD_TYPES}")
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}")