Explorar el Código

esptool+cmake: Fix path generation for args.in2 file

Path was accidentally generated as build/<absolute path to input file> which creates unexpected path structure on Linux/macOS and breaks Windows (as can't have a directory named "C:".

Regression in e8582e9aa441c3b2d988c73b582b2985f41042ac

Closes https://github.com/espressif/esp-idf/issues/3687
Closes IDFGH-1409
Angus Gratton hace 6 años
padre
commit
83ba2e082c
Se han modificado 1 ficheros con 8 adiciones y 4 borrados
  1. 8 4
      components/esptool_py/project_include.cmake

+ 8 - 4
components/esptool_py/project_include.cmake

@@ -183,12 +183,16 @@ function(esptool_py_flash_project_args entry offset image)
     else()
         set(OFFSET ${offset})
         set(IMAGE ${image})
-        get_filename_component(template "${__FLASH_FILE_TEMPLATE}" ABSOLUTE)
-        configure_file(${template} ${CMAKE_CURRENT_BINARY_DIR}/${template}.in2)
-        file(GENERATE OUTPUT ${entry_flash_args} INPUT ${CMAKE_CURRENT_BINARY_DIR}/${template}.in2)
+
+        get_filename_component(template_in "${__FLASH_FILE_TEMPLATE}" ABSOLUTE)
+        get_filename_component(template_name "${template_in}" NAME)
+        set(template_partial "${CMAKE_CURRENT_BINARY_DIR}/${template_name}.in2")
+
+        configure_file("${template_in}" "${template_partial}")
+        file(GENERATE OUTPUT ${entry_flash_args} INPUT "${template_partial}")
         set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
                     APPEND PROPERTY
-                    ADDITIONAL_MAKE_CLEAN_FILES ${CMAKE_CURRENT_BINARY_DIR}/${template}.in2})
+                    ADDITIONAL_MAKE_CLEAN_FILES "${template_partial}")
         unset(OFFSET)
         unset(IMAGE)
     endif()