Skip to content

CMake: greentea: Remove dependency on global MBED_PATH #14876

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 6, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions tools/cmake/mbed_greentea.cmake
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# 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:
# TEST_NAME - Test suite name
# TEST_INCLUDE_DIRS - Test suite include directories for the test
# TEST_SOURCES - Test suite sources
# TEST_REQUIRED_LIBS - Test suite required libraries
#
#
# calling the macro:
# mbed_greentea_add_test(
# TEST_NAME mbed-platform-system-reset
Expand All @@ -34,16 +34,13 @@ macro(mbed_greentea_add_test)
"${multipleValueArgs}"
${ARGN}
)

add_subdirectory(${MBED_PATH} build)
add_subdirectory(${MBED_ROOT} build)

add_executable(${MBED_GREENTEA_TEST_NAME})

# Explicitly enable BUILD_TESTING until CTest is added to the Greentea client
set(BUILD_TESTING ON)

mbed_configure_app_target(${MBED_GREENTEA_TEST_NAME})

target_include_directories(${MBED_GREENTEA_TEST_NAME}
PRIVATE
.
Expand All @@ -59,7 +56,7 @@ macro(mbed_greentea_add_test)
# For example:
# - To select mbed-os library, use cmake with -DMBED_TEST_LINK_LIBRARIES=mbed-os
# - To select baremetal library, use cmake with -DMBED_TEST_LINK_LIBRARIES=mbed-baremetal
# - To select baremetal with extra external error logging library to the test, use cmake with
# - To select baremetal with extra external error logging library to the test, use cmake with
# -D "MBED_TEST_LINK_LIBRARIES=mbed-baremetal ext-errorlogging"
if (DEFINED MBED_TEST_LINK_LIBRARIES)
separate_arguments(MBED_TEST_LINK_LIBRARIES)
Expand Down