Skip to content

Commit db8852c

Browse files
committed
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.
1 parent c01d417 commit db8852c

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

connectivity/FEATURE_BLE/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
# SPDX-License-Identifier: Apache-2.0
33

44
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)
5-
add_subdirectory(tests/UNITTESTS)
5+
if(NOT BUILD_GREENTEA_TESTS)
6+
add_subdirectory(tests/UNITTESTS)
7+
endif()
68
endif()
79

810
add_subdirectory(libraries)

connectivity/libraries/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
# SPDX-License-Identifier: Apache-2.0
33

44
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)
5-
add_subdirectory(tests/UNITTESTS)
5+
if(NOT BUILD_GREENTEA_TESTS)
6+
add_subdirectory(tests/UNITTESTS)
7+
endif()
68
endif()
79

810
add_subdirectory(mbed-coap)

connectivity/mbedtls/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
# SPDX-License-Identifier: Apache-2.0
33

44
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)
5-
add_subdirectory(tests/UNITTESTS)
5+
if(NOT BUILD_GREENTEA_TESTS)
6+
add_subdirectory(tests/UNITTESTS)
7+
endif()
68
endif()
79

810
target_include_directories(mbed-mbedtls

0 commit comments

Comments
 (0)