tests: CMakeLists.txt: move test names to variable

The intent is to be able to disable some features that get built into the
library. When we do that, we also need to disable some tests.

It's easier when adjusting a variable that contains the list of test names,
versus modifying the list in the foreach() statement.

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
This commit is contained in:
Alexandru Ardelean
2021-04-16 09:32:07 +03:00
parent 94909840be
commit 1f8b64f62c

View File

@@ -12,7 +12,7 @@ target_link_libraries(test2Formatted PRIVATE ${PROJECT_NAME})
include_directories(PUBLIC ${CMAKE_SOURCE_DIR}) include_directories(PUBLIC ${CMAKE_SOURCE_DIR})
foreach(TESTNAME set(ALL_TEST_NAMES
test1 test1
test2 test2
test4 test4
@@ -37,6 +37,8 @@ foreach(TESTNAME
test_visit test_visit
test_object_iterator) test_object_iterator)
foreach(TESTNAME ${ALL_TEST_NAMES})
add_executable(${TESTNAME} ${TESTNAME}.c) add_executable(${TESTNAME} ${TESTNAME}.c)
if(${TESTNAME} STREQUAL test_strerror OR ${TESTNAME} STREQUAL test_util_file) if(${TESTNAME} STREQUAL test_strerror OR ${TESTNAME} STREQUAL test_util_file)
# For output consistency, we need _json_c_strerror() in some tests: # For output consistency, we need _json_c_strerror() in some tests: