CMake: greentea: Remove dependency on global MBED_PATH

The mbed_greentea_add_test macro required a greentea test to set an
MBED_PATH variable to the path of the mbed-os root directory, which it
attempts to add as a 'subdirectory' of the test project. We can instead
use CMake's built in CMAKE_CURRENT_LIST_DIR variable to deduce the path
to mbed-os relative to the current list file directory, removing the
need for greentea tests to set MBED_PATH.
pull/14876/head
Robert Walton 2021-07-05 15:00:30 +01:00
parent d5a4ad1fe9
commit dfb4e087e3
1 changed files with 2 additions and 3 deletions

View File

@ -1,9 +1,9 @@
# Copyright (c) 2020-2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set(MBED_CONFIG_PATH ${CMAKE_CURRENT_BINARY_DIR} CACHE INTERNAL "")
include(${CMAKE_CURRENT_LIST_DIR}/app.cmake)
set(MBED_ROOT ${CMAKE_CURRENT_LIST_DIR}/../.. CACHE INTERNAL "")
# CMake Macro for generalizing CMake configuration across the greentea test suite with configurable parameters
# Macro args:
@ -34,8 +34,7 @@ macro(mbed_greentea_add_test)
"${multipleValueArgs}"
${ARGN}
)
add_subdirectory(${MBED_PATH} build)
add_subdirectory(${MBED_ROOT} build)
add_executable(${MBED_GREENTEA_TEST_NAME})