CMakeLists.txt 1.4 KB

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