CMakeLists.txt 1.1 KB

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