From dfb4e087e3c3fbd030e2f6cab8a48eeee2eb8216 Mon Sep 17 00:00:00 2001 From: Robert Walton Date: Mon, 5 Jul 2021 15:00:30 +0100 Subject: [PATCH] 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. --- tools/cmake/mbed_greentea.cmake | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/cmake/mbed_greentea.cmake b/tools/cmake/mbed_greentea.cmake index e560b49370..c108712c53 100644 --- a/tools/cmake/mbed_greentea.cmake +++ b/tools/cmake/mbed_greentea.cmake @@ -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})