OVMS3-idf/tools/cmake/bootloader_subproject.cmake
2018-04-30 09:59:20 +10:00

27 lines
1.1 KiB
CMake

# Glue to build the bootloader subproject binary as an external
# cmake project under this one
#
#
set(bootloader_subproject_build_dir "${CMAKE_BINARY_DIR}/bootloader_subproject")
set(bootloader_binary_files
"${bootloader_subproject_build_dir}/bootloader.elf"
"${bootloader_subproject_build_dir}/bootloader.bin"
"${bootloader_subproject_build_dir}/bootloader.map"
)
ExternalProject_Add(bootloader_subproject
# TODO: support overriding the bootloader in COMPONENT_PATHS
SOURCE_DIR "${IDF_PATH}/components/bootloader/subproject"
BINARY_DIR "${bootloader_subproject_build_dir}"
CMAKE_ARGS -DSDKCONFIG=${SDKCONFIG} -DIDF_PATH="${IDF_PATH}"
INSTALL_COMMAND ""
BUILD_ALWAYS 1 # no easy way around this...
BUILD_BYPRODUCTS ${bootloader_binary_files}
)
# this is a hack due to an (annoying) shortcoming in cmake, it can't
# extend the 'clean' target to the external project
# see thread: https://cmake.org/pipermail/cmake/2016-December/064660.html
#
# So for now we just have the top-level build remove the final build products...
set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${bootloader_binary_files})