From 00e47edd3e7dbf3e4f0e1cdd2a9941a267e1e3e4 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Fri, 21 Jun 2024 10:46:11 +0100 Subject: [PATCH 1/2] cmake: modules: extension: Fix dts file watch Fixes an issue in the code that processes the output file of a compiler to see which files should be watched, the compiler can combine multiple files into a single line instead of putting them each on separate lines if the length of the file paths is short, therefore account for this and split it up into multiple elements Signed-off-by: Jamie McCrae (cherry picked from commit f4cfb8cd966cc7c1bb63cd30a744527fb43dcb26) --- cmake/modules/extensions.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmake/modules/extensions.cmake b/cmake/modules/extensions.cmake index 061ed7747c1eaf..58c8dc2a8fda61 100644 --- a/cmake/modules/extensions.cmake +++ b/cmake/modules/extensions.cmake @@ -2095,6 +2095,10 @@ function(toolchain_parse_make_rule input_file include_files) # the element separator, so let's get the pure `;` back. string(REPLACE "\;" ";" input_as_list ${input}) + # The file might also contain multiple files on one line if one or both of + # the file paths are short, split these up into multiple elements using regex + string(REGEX REPLACE "([^ ])[ ]([^ ])" "\\1;\\2" input_as_list "${input_as_list}") + # Pop the first line and treat it specially list(POP_FRONT input_as_list first_input_line) string(FIND ${first_input_line} ": " index) From 3dc33b67fb6935acdd5f48e87eed670067441780 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Fri, 21 Jun 2024 11:41:49 +0100 Subject: [PATCH 2/2] cmake: modules: extensions: Fix dts watch file processing Fixes and simplifies the handling of how the dts watch file is processed Signed-off-by: Grzegorz Swiderski Signed-off-by: Jamie McCrae (cherry picked from commit 11c1f3de616e7d22b99f65925ba42bfb7c7c1be4) --- cmake/modules/extensions.cmake | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/cmake/modules/extensions.cmake b/cmake/modules/extensions.cmake index 58c8dc2a8fda61..12e0e4731eb6b9 100644 --- a/cmake/modules/extensions.cmake +++ b/cmake/modules/extensions.cmake @@ -2099,16 +2099,8 @@ function(toolchain_parse_make_rule input_file include_files) # the file paths are short, split these up into multiple elements using regex string(REGEX REPLACE "([^ ])[ ]([^ ])" "\\1;\\2" input_as_list "${input_as_list}") - # Pop the first line and treat it specially + # Pop the first item containing "empty_file.o:" list(POP_FRONT input_as_list first_input_line) - string(FIND ${first_input_line} ": " index) - math(EXPR j "${index} + 2") - string(SUBSTRING ${first_input_line} ${j} -1 first_include_file) - - # Remove whitespace before and after filename and convert to CMake path. - string(STRIP "${first_include_file}" first_include_file) - file(TO_CMAKE_PATH "${first_include_file}" first_include_file) - set(result "${first_include_file}") # Remove whitespace before and after filename and convert to CMake path. foreach(file ${input_as_list})