1idf_component_register(SRCS "esp_app_desc.c"
2                    INCLUDE_DIRS "include")
3
4# esp_app_desc structure is added as an undefined symbol because otherwise the
5# linker will ignore this structure as it has no other files depending on it.
6if(NOT BOOTLOADER_BUILD)
7    target_link_libraries(${COMPONENT_LIB} INTERFACE "-u esp_app_desc")
8endif()
9
10if(CONFIG_APP_PROJECT_VER_FROM_CONFIG)
11    # Ignore current PROJECT_VER (which was set in __project_get_revision()).
12    # Gets the version from the CONFIG_APP_PROJECT_VER.
13    idf_build_set_property(PROJECT_VER "${CONFIG_APP_PROJECT_VER}")
14endif()
15
16# cut PROJECT_VER and PROJECT_NAME to required 32 characters.
17idf_build_get_property(project_ver PROJECT_VER)
18idf_build_get_property(project_name PROJECT_NAME)
19string(SUBSTRING "${project_ver}" 0 31 PROJECT_VER_CUT)
20string(SUBSTRING "${project_name}" 0 31 PROJECT_NAME_CUT)
21message(STATUS "App \"${PROJECT_NAME_CUT}\" version: ${PROJECT_VER_CUT}")
22
23set_source_files_properties(
24    SOURCE "esp_app_desc.c"
25    PROPERTIES COMPILE_DEFINITIONS
26    "PROJECT_VER=\"${PROJECT_VER_CUT}\"; PROJECT_NAME=\"${PROJECT_NAME_CUT}\"")
27