mirror of
https://github.com/NVIDIA/nvbench.git
synced 2026-04-29 19:21:14 +00:00
Use CMake to generate --help strings from markdown docs.
This commit is contained in:
19
cmake/FileToString.cmake
Normal file
19
cmake/FileToString.cmake
Normal file
@@ -0,0 +1,19 @@
|
||||
# file_to_string(file_in file_out string_name)
|
||||
#
|
||||
# Create a C++ file `file_out` that defines a string named `string_name` in
|
||||
# `namespace`, which contains the contents of `file_in`.
|
||||
|
||||
function(file_to_string file_in file_out namespace string_name)
|
||||
file(READ "${file_in}" file_in_contents)
|
||||
|
||||
set(file_out_contents)
|
||||
string(APPEND file_out_contents
|
||||
"#include <string>\n"
|
||||
"namespace ${namespace} {\n"
|
||||
"const std::string ${string_name} =\n"
|
||||
"R\"expected(${file_in_contents})expected\";\n"
|
||||
"}\n"
|
||||
)
|
||||
|
||||
file(WRITE "${file_out}" "${file_out_contents}")
|
||||
endfunction()
|
||||
Reference in New Issue
Block a user