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