Skip to content

Instantly share code, notes, and snippets.

@chfast
Created May 6, 2019 09:05
Show Gist options
  • Save chfast/d738c74d710d29bcb05de42c948be41a to your computer and use it in GitHub Desktop.
Save chfast/d738c74d710d29bcb05de42c948be41a to your computer and use it in GitHub Desktop.
Covert CMake list into C array of string literals
# Generated file:
const char* allTests[] =
{
"A",
"B",
"C",
"D",
"E",
};
const char* allTests[] =
{
@ALL_TESTS@
};
set(tests_list A;B;C;D;E)
foreach(t ${tests_list})
set(ALL_TESTS "${ALL_TESTS} \"${t}\",\n")
endforeach()
configure_file(all_tests.h.in all_tests.h)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment