| 1 |
function(generate_from_file in out) |
| 2 |
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/file_ip.txt "${in}") |
| 3 |
file(GENERATE |
| 4 |
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/$<LOWER_CASE:$<CONFIG>>/file_op.txt |
| 5 |
INPUT ${CMAKE_CURRENT_BINARY_DIR}/file_ip.txt |
| 6 |
NEWLINE_STYLE UNIX |
| 7 |
) |
| 8 |
|
| 9 |
add_custom_target(verifyContentFromFile ALL |
| 10 |
COMMAND ${CMAKE_COMMAND} |
| 11 |
-DgeneratedFile=${CMAKE_CURRENT_BINARY_DIR}/$<LOWER_CASE:$<CONFIG>>/file_op.txt |
| 12 |
-DexpectedContent=${out} |
| 13 |
-P "${CMAKE_CURRENT_SOURCE_DIR}/VerifyContent.cmake" |
| 14 |
) |
| 15 |
endfunction() |
| 16 |
|
| 17 |
function(generate_from_content in out) |
| 18 |
file(GENERATE |
| 19 |
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/$<LOWER_CASE:$<CONFIG>>/content_op.txt |
| 20 |
CONTENT ${in} |
| 21 |
NEWLINE_STYLE UNIX |
| 22 |
) |
| 23 |
|
| 24 |
add_custom_target(verifyContentFromContent ALL |
| 25 |
COMMAND ${CMAKE_COMMAND} |
| 26 |
-DgeneratedFile=${CMAKE_CURRENT_BINARY_DIR}/$<LOWER_CASE:$<CONFIG>>/content_op.txt |
| 27 |
-DexpectedContent=${out} |
| 28 |
-P "${CMAKE_CURRENT_SOURCE_DIR}/VerifyContent.cmake" |
| 29 |
) |
| 30 |
endfunction() |
| 31 |
|
| 32 |
generate_from_file("a" "610a") # 62->b, 0a->\n |
| 33 |
generate_from_content("a" "610a") |