From ecb56f9523e7b03cb08945a79f7c36c5f6a20b16 Mon Sep 17 00:00:00 2001 From: shahbajsohal Date: Tue, 1 Aug 2023 14:27:41 -0700 Subject: [PATCH] changed the way the test_name was added and add_test was called with it --- examples/templates/cmakelists_C_ex.in | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/examples/templates/cmakelists_C_ex.in b/examples/templates/cmakelists_C_ex.in index 67c6cfaa4e..61f78bb7f2 100644 --- a/examples/templates/cmakelists_C_ex.in +++ b/examples/templates/cmakelists_C_ex.in @@ -101,14 +101,13 @@ foreach(idx RANGE ${len}) # libraries to link against target_link_libraries(${example_target} ${SUNDIALS_TARGETS} ${EXTRA_LIBS}) - # add the example to ctest - if("${example_args}" STREQUAL "") - set(test_name ${example}) + if("${example_args}" MATCHES "") + set(test_name ${example_target}) + add_test(NAME ${test_name} COMMAND ${example_target}) else() - string(REGEX REPLACE " " "_" test_name ${example}_${example_args}) + string(REGEX REPLACE " " "_" test_name ${example_target}_${example_args}) + separate_arguments(example_args_wo_quotes UNIX_COMMAND ${example_args}) + add_test(NAME ${test_name} COMMAND ${example_target} ${example_args_wo_quotes}) endif() - string(REPLACE "" "" example_args "${example_args}") - separate_arguments(example_args_wo_quotes UNIX_COMMAND "${example_args}") - add_test(NAME ${test_name} COMMAND ${example_target} ${example_args_wo_quotes}) endforeach()