From 07af6ddcf74a80136077af66688de497f2f1a8e0 Mon Sep 17 00:00:00 2001 From: Sudeep Mohanty Date: Wed, 13 May 2026 17:26:32 +0200 Subject: [PATCH] fix(host_test): use ${project_elf} variable and keyword link form Three host_test CMakeLists.txt files relied on idioms tied to a specific build system layout. Make them portable: - spiffs/host_test and esp_partition/host_test/partition_api_test passed a hard-coded ".elf" target name to add_dependencies(). Use ${project_elf}, the canonical variable that resolves to the live executable target name in either build system. - nvs_flash/host_test/nvs_page_test linked --coverage using the plain signature of target_link_libraries. CMake forbids mixing plain and keyword signatures on the same target; the component library link already uses the keyword form. Switch the --coverage link to the keyword signature. --- .../esp_partition/host_test/partition_api_test/CMakeLists.txt | 2 +- .../nvs_flash/host_test/nvs_page_test/main/CMakeLists.txt | 2 +- components/spiffs/host_test/CMakeLists.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/esp_partition/host_test/partition_api_test/CMakeLists.txt b/components/esp_partition/host_test/partition_api_test/CMakeLists.txt index e2f75e47709..ead8ac860c6 100644 --- a/components/esp_partition/host_test/partition_api_test/CMakeLists.txt +++ b/components/esp_partition/host_test/partition_api_test/CMakeLists.txt @@ -41,4 +41,4 @@ add_custom_target(partition-table-8M ${partition_table_display} VERBATIM) -add_dependencies(partition_api_test.elf partition-table partition-table-8M) +add_dependencies(${project_elf} partition-table partition-table-8M) diff --git a/components/nvs_flash/host_test/nvs_page_test/main/CMakeLists.txt b/components/nvs_flash/host_test/nvs_page_test/main/CMakeLists.txt index ef19b495893..37dd200b799 100644 --- a/components/nvs_flash/host_test/nvs_page_test/main/CMakeLists.txt +++ b/components/nvs_flash/host_test/nvs_page_test/main/CMakeLists.txt @@ -8,7 +8,7 @@ idf_component_register(SRCS "nvs_page_test.cpp" PRIV_REQUIRES spi_flash) target_compile_options(${COMPONENT_LIB} PUBLIC --coverage) -target_link_libraries(${COMPONENT_LIB} --coverage) +target_link_libraries(${COMPONENT_LIB} PUBLIC --coverage) if(CMAKE_C_COMPILER_ID MATCHES "Clang") target_compile_options(${COMPONENT_LIB} PRIVATE -std=gnu++20) endif() diff --git a/components/spiffs/host_test/CMakeLists.txt b/components/spiffs/host_test/CMakeLists.txt index ad58d6cb410..5d962307296 100644 --- a/components/spiffs/host_test/CMakeLists.txt +++ b/components/spiffs/host_test/CMakeLists.txt @@ -23,4 +23,4 @@ set_property( APPEND PROPERTY ADDITIONAL_CLEAN_FILES "${build_dir}/image.bin") -add_dependencies(host_test_spiffs.elf image.bin) +add_dependencies(${project_elf} image.bin)