CMake: connectivity: Guard unit test directories

When unit tests or unit test stubs get added as CMake targets, they
becomes part of the "all" target and get compiled when building the
whole project. When building greentea tests we need to disable unit
tests and stubs to avoid unnecessary compilation and errors.
pull/15096/head
Lingkai Dong 2021-09-16 16:37:32 +01:00
parent c01d417ed4
commit db8852c5d8
3 changed files with 9 additions and 3 deletions

View File

@ -2,8 +2,10 @@
# SPDX-License-Identifier: Apache-2.0
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)
if(NOT BUILD_GREENTEA_TESTS)
add_subdirectory(tests/UNITTESTS)
endif()
endif()
add_subdirectory(libraries)
add_subdirectory(source)

View File

@ -2,8 +2,10 @@
# SPDX-License-Identifier: Apache-2.0
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)
if(NOT BUILD_GREENTEA_TESTS)
add_subdirectory(tests/UNITTESTS)
endif()
endif()
add_subdirectory(mbed-coap)
add_subdirectory(nanostack-libservice)

View File

@ -2,8 +2,10 @@
# SPDX-License-Identifier: Apache-2.0
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)
if(NOT BUILD_GREENTEA_TESTS)
add_subdirectory(tests/UNITTESTS)
endif()
endif()
target_include_directories(mbed-mbedtls
INTERFACE