From 83ba2e082cfbcd75674862ebcec395771d634b1b Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Wed, 26 Jun 2019 14:55:20 +1000 Subject: [PATCH] esptool+cmake: Fix path generation for args.in2 file Path was accidentally generated as build/ 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 --- components/esptool_py/project_include.cmake | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/components/esptool_py/project_include.cmake b/components/esptool_py/project_include.cmake index 70d12caf7..7d064f9c2 100644 --- a/components/esptool_py/project_include.cmake +++ b/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()