Skip to content

Commit dfb4e08

Browse files
committed
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.
1 parent d5a4ad1 commit dfb4e08

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

tools/cmake/mbed_greentea.cmake

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Copyright (c) 2020-2021 ARM Limited. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
3-
43
set(MBED_CONFIG_PATH ${CMAKE_CURRENT_BINARY_DIR} CACHE INTERNAL "")
54

65
include(${CMAKE_CURRENT_LIST_DIR}/app.cmake)
6+
set(MBED_ROOT ${CMAKE_CURRENT_LIST_DIR}/../.. CACHE INTERNAL "")
77

88
# CMake Macro for generalizing CMake configuration across the greentea test suite with configurable parameters
99
# Macro args:
@@ -34,8 +34,7 @@ macro(mbed_greentea_add_test)
3434
"${multipleValueArgs}"
3535
${ARGN}
3636
)
37-
38-
add_subdirectory(${MBED_PATH} build)
37+
add_subdirectory(${MBED_ROOT} build)
3938

4039
add_executable(${MBED_GREENTEA_TEST_NAME})
4140

0 commit comments

Comments
 (0)