diff --git a/cmake/VoidTestScanner.cmake b/cmake/VoidTestScanner.cmake index db8406a..b18b6ef 100644 --- a/cmake/VoidTestScanner.cmake +++ b/cmake/VoidTestScanner.cmake @@ -2,7 +2,14 @@ if(NOT INPUT_FILE OR NOT OUTPUT_FILE OR NOT SUITE_NAME) message(FATAL_ERROR "INPUT_FILE, OUTPUT_FILE, and SUITE_NAME must be provided.") endif() -file(STRINGS ${INPUT_FILE} lines) +file(READ "${INPUT_FILE}" _raw_content) +string(REPLACE "\r\n" "\n" _raw_content "${_raw_content}") +string(REPLACE "\r" "\n" _raw_content "${_raw_content}") +string(REPLACE "\\" "__VOID_SCAN_BS__" _raw_content "${_raw_content}") +string(REPLACE ";" "__VOID_SCAN_SC__" _raw_content "${_raw_content}") +string(REPLACE "[" "__VOID_SCAN_LB__" _raw_content "${_raw_content}") +string(REPLACE "]" "__VOID_SCAN_RB__" _raw_content "${_raw_content}") +string(REPLACE "\n" ";" lines "${_raw_content}") # Forward-slash path for C++ string literals / #include (always set, so files # whose tests are all reflection-registered Suite<> structs still emit a valid @@ -21,6 +28,10 @@ set(current_skip "") foreach(line IN LISTS lines) math(EXPR line_number "${line_number} + 1") + string(REPLACE "__VOID_SCAN_RB__" "]" line "${line}") + string(REPLACE "__VOID_SCAN_LB__" "[" line "${line}") + string(REPLACE "__VOID_SCAN_SC__" ";" line "${line}") + string(REPLACE "__VOID_SCAN_BS__" "\\" line "${line}") # Parse preceding comments for @tag and @skip string(REGEX MATCH "//[ \t]*@tag[ \t]+(.*)" _tag_match "${line}")