mirror of
https://github.com/espressif/esp-idf.git
synced 2026-09-22 13:01:16 +03:00
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 "<project>.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.
27 lines
801 B
CMake
27 lines
801 B
CMake
cmake_minimum_required(VERSION 3.22)
|
|
|
|
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
|
set(COMPONENTS main)
|
|
# Freertos is included via common components, however, currently only the mock component is compatible with linux
|
|
# target.
|
|
list(APPEND EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/mocks/freertos/")
|
|
|
|
project(host_test_spiffs)
|
|
|
|
# Custom procedure to build/clean image.bin
|
|
add_custom_target(image.bin)
|
|
|
|
# Expand image.bin to the same size as "spiffs" partition in partition_table.csv - 2*1024*1024 = 2097152 = 2M
|
|
add_custom_command(
|
|
TARGET image.bin
|
|
POST_BUILD
|
|
COMMAND python ../../spiffsgen.py 2097152 ../../spiffs ${build_dir}/image.bin
|
|
)
|
|
|
|
set_property(
|
|
DIRECTORY
|
|
APPEND PROPERTY ADDITIONAL_CLEAN_FILES "${build_dir}/image.bin")
|
|
|
|
|
|
add_dependencies(${project_elf} image.bin)
|