CMake: greentea: Set variables usually defined by external apps

We rely on external applications to set MBED_CONFIG_PATH and include
app.cmake. Mbed OS can't build for a target without those parameters
set. When building greentea tests there is no external application. So,
we define the appropriate settings in our root CMakeLists.txt for
greentea tests.
pull/14949/head
Robert Walton 2021-07-07 17:17:14 +01:00
parent 5afc3f8efa
commit bfac0b2d02
1 changed files with 9 additions and 0 deletions

View File

@ -7,6 +7,15 @@ cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR)
option(BUILD_GREENTEA_TESTS "Build greentea tests only." OFF) option(BUILD_GREENTEA_TESTS "Build greentea tests only." OFF)
if(BUILD_GREENTEA_TESTS)
# Usually we rely on the application to set MBED_CONFIG_PATH and include
# app.cmake. They are both required if we're building an application to run
# on an mbed-target.
set(MBED_CONFIG_PATH ${CMAKE_CURRENT_BINARY_DIR} CACHE STRING "")
# TODO: Remove when https://github.com/ARMmbed/mbed-os/issues/14518 is fixed
include(${CMAKE_CURRENT_LIST_DIR}/tools/cmake/app.cmake)
endif()
if(${CMAKE_CROSSCOMPILING}) if(${CMAKE_CROSSCOMPILING})
include(${MBED_CONFIG_PATH}/mbed_config.cmake) include(${MBED_CONFIG_PATH}/mbed_config.cmake)
include(mbed_set_linker_script) include(mbed_set_linker_script)