project_include.cmake 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. if(BOOTLOADER_BUILD)
  2. return() # don't keep recursing!
  3. endif()
  4. # Glue to build the bootloader subproject binary as an external
  5. # cmake project under this one
  6. #
  7. #
  8. set(bootloader_build_dir "${CMAKE_BINARY_DIR}/bootloader")
  9. set(bootloader_binary_files
  10. "${bootloader_build_dir}/bootloader.elf"
  11. "${bootloader_build_dir}/bootloader.bin"
  12. "${bootloader_build_dir}/bootloader.map"
  13. )
  14. externalproject_add(bootloader
  15. # TODO: support overriding the bootloader in COMPONENT_PATHS
  16. SOURCE_DIR "${IDF_PATH}/components/bootloader/subproject"
  17. BINARY_DIR "${bootloader_build_dir}"
  18. CMAKE_ARGS -DSDKCONFIG=${SDKCONFIG} -DIDF_PATH=${IDF_PATH}
  19. INSTALL_COMMAND ""
  20. BUILD_ALWAYS 1 # no easy way around this...
  21. BUILD_BYPRODUCTS ${bootloader_binary_files}
  22. )
  23. # this is a hack due to an (annoying) shortcoming in cmake, it can't
  24. # extend the 'clean' target to the external project
  25. # see thread: https://cmake.org/pipermail/cmake/2016-December/064660.html
  26. #
  27. # So for now we just have the top-level build remove the final build products...
  28. set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" APPEND PROPERTY
  29. ADDITIONAL_MAKE_CLEAN_FILES
  30. ${bootloader_binary_files})