[cmake] guard unit tests with BUILD_TESTING (#8739)

This commit is contained in:
Jonathan Hui
2023-02-09 18:24:20 -08:00
committed by GitHub
parent 630099bde6
commit 3d7626f560
2 changed files with 21 additions and 17 deletions
+9 -7
View File
@@ -85,10 +85,12 @@ target_link_libraries(openthread-spinel-rcp
ot-config
)
add_executable(ot-test-spinel
spinel.c
)
target_compile_definitions(ot-test-spinel
PRIVATE -DSPINEL_SELF_TEST=1 -D_GNU_SOURCE
)
add_test(NAME ot-test-spinel COMMAND ot-test-spinel)
if(BUILD_TESTING)
add_executable(ot-test-spinel
spinel.c
)
target_compile_definitions(ot-test-spinel
PRIVATE -DSPINEL_SELF_TEST=1 -D_GNU_SOURCE
)
add_test(NAME ot-test-spinel COMMAND ot-test-spinel)
endif()
+12 -10
View File
@@ -32,13 +32,15 @@ add_library(openthread-url EXCLUDE_FROM_ALL
target_link_libraries(openthread-url PRIVATE ot-config)
add_executable(ot-test-url
url.cpp
)
target_compile_definitions(ot-test-url
PRIVATE -DSELF_TEST=1
)
target_link_libraries(ot-test-url
PRIVATE ot-config
)
add_test(NAME ot-test-url COMMAND ot-test-url)
if(BUILD_TESTING)
add_executable(ot-test-url
url.cpp
)
target_compile_definitions(ot-test-url
PRIVATE -DSELF_TEST=1
)
target_link_libraries(ot-test-url
PRIVATE ot-config
)
add_test(NAME ot-test-url COMMAND ot-test-url)
endif()