Hi,
I am trying to set up an MCUBoot child image. But when building the project, I get this CMake warning:
-- Found Python3: C:/ncs/toolchains/31f4403e35/opt/bin/python.exe (found version "3.8.2") found components: Interpreter === child image mcuboot - begin === loading initial cache file C:/GitLab/my_project/project/app/build/mcuboot/child_image_preload.cmake CMake Warning (dev) at C:/GitLab/my_project/project/app/build/mcuboot/child_image_preload.cmake:7 (set): Syntax error in cmake code at C:/GitLab/my_project/project/app/build/mcuboot/child_image_preload.cmake:7 when parsing string c:\ncs\toolchains\31f4403e35\opt\bin\python.exe Invalid escape sequence \3 Policy CMP0010 is not set: Bad variable reference syntax is an error. Run "cmake --help-policy CMP0010" for policy details. Use the cmake_policy command to set the policy and suppress this warning. This warning is for project developers. Use -Wno-dev to suppress it. Loading Zephyr default modules (Zephyr base (cached)).
Looking at child_image_preload.cmake, I see that WEST_PYTHON is as follows:
`set(WEST_PYTHON "c:\ncs\toolchains\31f4403e35\opt\bin\python.exe" CACHE INTERNAL "NCS child image controlled")`
This string uses a single backslash (string escape), instead of double backslashes or a single forward slash.
I tried adding string replaces to `multi_image.cmake`, but this didn't solve it.
...:89 foreach(app_var_name ${application_vars}) string(REPLACE "\"" "\\\"" app_var_value "${${app_var_name}}") string(REPLACE "\\" "\\\\" app_var_value "${${app_var_name}}") # Added to make string safe file( APPEND ${base_image_preload_file} "set(${app_var_name} \"${app_var_value}\" CACHE INTERNAL \"NCS child image controlled\")\n" ) endforeach() ... ... :400 foreach(var_name ${VARIABLES_ALL}) string(REPLACE "\"" "\\\"" ${var_name} "${${var_name}}") string(REPLACE "\\" "\\\\" ${var_name} "${${var_name}}") # Added to make string safe # This regex is guaranteed to match due to the filtering done # above, we only re-run the regex to extract the part after # '_'. We run the regex twice because it is believed that # list(FILTER is faster than doing a string(REGEX on each item. string(REGEX MATCH "^${ACI_NAME}_(.+)" unused_out_var ${var_name}) file( APPEND ${preload_file} "set(${CMAKE_MATCH_1} \"${${var_name}}\" CACHE INTERNAL \"NCS child image controlled\")\n" ) endforeach()
Do you know how I can fix it?
Edit:- nRF Connect SDK: v2.4.0 (installed through toolchain manager)
- OS: Windows 11
- Python version: 3.11.3
- CMake version: 3.26.3
Kind regards,
Tim