diff --git a/components/bootloader/project_include.cmake b/components/bootloader/project_include.cmake index 2f3b3eb8a8..c23ec362bb 100644 --- a/components/bootloader/project_include.cmake +++ b/components/bootloader/project_include.cmake @@ -148,5 +148,5 @@ endif() # # 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 + ADDITIONAL_CLEAN_FILES ${bootloader_binary_files}) diff --git a/components/bootloader_support/CMakeLists.txt b/components/bootloader_support/CMakeLists.txt index d1b5db87dc..197e46b052 100644 --- a/components/bootloader_support/CMakeLists.txt +++ b/components/bootloader_support/CMakeLists.txt @@ -164,7 +164,7 @@ if(CONFIG_SECURE_SIGNED_APPS AND (CONFIG_SECURE_BOOT_V1_ENABLED OR CONFIG_SECURE target_add_binary_data(${COMPONENT_LIB} "${secure_boot_verification_key}" "BINARY" RENAME_TO signature_verification_key_bin) set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" - APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES + APPEND PROPERTY ADDITIONAL_CLEAN_FILES "${secure_boot_verification_key}") endif() diff --git a/components/esptool_py/project_include.cmake b/components/esptool_py/project_include.cmake index 064a0825c0..46c1259113 100644 --- a/components/esptool_py/project_include.cmake +++ b/components/esptool_py/project_include.cmake @@ -149,7 +149,7 @@ if(CONFIG_APP_BUILD_GENERATE_BINARIES) endif() set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" - APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES + APPEND PROPERTY ADDITIONAL_CLEAN_FILES "${build_dir}/${unsigned_project_binary}" ) @@ -182,7 +182,7 @@ if(NOT BOOTLOADER_BUILD AND CONFIG_SECURE_SIGNED_APPS) add_dependencies(gen_project_binary gen_signed_project_binary) set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" - APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES + APPEND PROPERTY ADDITIONAL_CLEAN_FILES "${build_dir}/${PROJECT_BIN}" ) else() diff --git a/components/fatfs/project_include.cmake b/components/fatfs/project_include.cmake index a3540e1211..d945c0e96e 100644 --- a/components/fatfs/project_include.cmake +++ b/components/fatfs/project_include.cmake @@ -57,7 +57,7 @@ function(fatfs_create_partition_image partition base_dir) --sector_size "${fatfs_sector_size}" ) set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" APPEND PROPERTY - ADDITIONAL_MAKE_CLEAN_FILES + ADDITIONAL_CLEAN_FILES ${image_file}) idf_component_get_property(main_args esptool_py FLASH_ARGS) diff --git a/components/mbedtls/CMakeLists.txt b/components/mbedtls/CMakeLists.txt index f19571e3e3..fc33140295 100644 --- a/components/mbedtls/CMakeLists.txt +++ b/components/mbedtls/CMakeLists.txt @@ -69,7 +69,7 @@ if(CONFIG_MBEDTLS_CERTIFICATE_BUNDLE) target_add_binary_data(${COMPONENT_LIB} ${crt_bundle} BINARY) set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" - APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES + APPEND PROPERTY ADDITIONAL_CLEAN_FILES "${crt_bundle}") endif() diff --git a/components/spiffs/project_include.cmake b/components/spiffs/project_include.cmake index d7c8bf0b2c..c322a64b06 100644 --- a/components/spiffs/project_include.cmake +++ b/components/spiffs/project_include.cmake @@ -44,7 +44,7 @@ function(spiffs_create_partition_image partition base_dir) ) set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" APPEND PROPERTY - ADDITIONAL_MAKE_CLEAN_FILES + ADDITIONAL_CLEAN_FILES ${image_file}) idf_component_get_property(main_args esptool_py FLASH_ARGS) diff --git a/docs/en/api-guides/build-system.rst b/docs/en/api-guides/build-system.rst index b588608532..4c311e2b09 100644 --- a/docs/en/api-guides/build-system.rst +++ b/docs/en/api-guides/build-system.rst @@ -806,11 +806,11 @@ Some components will have a situation where a source file isn't supplied with th add_dependencies(${COMPONENT_LIB} logo) set_property(DIRECTORY "${COMPONENT_DIR}" APPEND PROPERTY - ADDITIONAL_MAKE_CLEAN_FILES logo.h) + ADDITIONAL_CLEAN_FILES logo.h) This answer is adapted from the `CMake FAQ entry `_, which contains some other examples that will also work with ESP-IDF builds. -In this example, logo.h will be generated in the current directory (the build directory) while logo.bmp comes with the component and resides under the component path. Because logo.h is a generated file, it should be cleaned when the project is cleaned. For this reason, it is added to the `ADDITIONAL_MAKE_CLEAN_FILES`_ property. +In this example, logo.h will be generated in the current directory (the build directory) while logo.bmp comes with the component and resides under the component path. Because logo.h is a generated file, it should be cleaned when the project is cleaned. For this reason, it is added to the `ADDITIONAL_CLEAN_FILES`_ property. .. note:: @@ -905,7 +905,7 @@ Obviously, there are cases where all these recipes are insufficient for a certai set_target_properties(quirc PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${COMPONENT_DIR}/quirc/lib) - set_directory_properties( PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES + set_directory_properties( PROPERTIES ADDITIONAL_CLEAN_FILES "${COMPONENT_DIR}/quirc/libquirc.a") (The above CMakeLists.txt can be used to create a component named ``quirc`` that builds the quirc_ project using its own Makefile.) @@ -917,20 +917,20 @@ Obviously, there are cases where all these recipes are insufficient for a certai - Consult the ExternalProject_ documentation for more details about ``externalproject_add()`` - The second set of commands adds a library target, which points to the "imported" library file built by the external system. Some properties need to be set in order to add include directories and tell CMake where this file is. -- Finally, the generated library is added to `ADDITIONAL_MAKE_CLEAN_FILES`_. This means ``make clean`` will delete this library. (Note that the other object files from the build won't be deleted.) +- Finally, the generated library is added to `ADDITIONAL_CLEAN_FILES`_. This means ``make clean`` will delete this library. (Note that the other object files from the build won't be deleted.) .. only:: esp32 .. note:: When using an external build process with PSRAM, remember to add ``-mfix-esp32-psram-cache-issue`` to the C compiler arguments. See :ref:`CONFIG_SPIRAM_CACHE_WORKAROUND` for details of this flag. -.. _ADDITIONAL_MAKE_CLEAN_FILES_note: +.. _ADDITIONAL_CLEAN_FILES_note: ExternalProject Dependencies and Clean Builds ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ CMake has some unusual behavior around external project builds: -- `ADDITIONAL_MAKE_CLEAN_FILES`_ only works when "make" is used as the build system. If Ninja_ or an IDE build system is used, it won't delete these files when cleaning. +- `ADDITIONAL_CLEAN_FILES`_ only works when "make" or "ninja" is used as the build system. If an IDE build system is used, it won't delete these files when cleaning. - However, the ExternalProject_ configure & build commands will *always* be re-run after a clean is run. - Therefore, there are two alternative recommended ways to configure the external build command: @@ -1477,7 +1477,7 @@ Some features are significantly different or removed in the CMake-based system. - ``COMPONENT_EXTRA_INCLUDES``: Used to be an alternative to ``COMPONENT_PRIV_INCLUDEDIRS`` for absolute paths. Use ``PRIV_INCLUDE_DIRS`` argument to ``idf_component_register`` for all cases now (can be relative or absolute). - ``COMPONENT_OBJS``: Previously, component sources could be specified as a list of object files. Now they can be specified as a list of source files via ``SRCS`` argument to `idf_component_register`. - ``COMPONENT_OBJEXCLUDE``: Has been replaced with ``EXCLUDE_SRCS`` argument to ``idf_component_register``. Specify source files (as absolute paths or relative to component directory), instead. -- ``COMPONENT_EXTRA_CLEAN``: Set property ``ADDITIONAL_MAKE_CLEAN_FILES`` instead but note :ref:`CMake has some restrictions around this functionality `. +- ``COMPONENT_EXTRA_CLEAN``: Set property ``ADDITIONAL_CLEAN_FILES`` instead but note :ref:`CMake has some restrictions around this functionality `. - ``COMPONENT_OWNBUILDTARGET`` & ``COMPONENT_OWNCLEANTARGET``: Use CMake `ExternalProject`_ instead. See :ref:`component-build-full-override` for full details. - ``COMPONENT_CONFIG_ONLY``: Call ``idf_component_register`` without any arguments instead. See `Configuration-Only Components`_. - ``CFLAGS``, ``CPPFLAGS``, ``CXXFLAGS``: Use equivalent CMake commands instead. See `Controlling Component Compilation`_. @@ -1514,7 +1514,7 @@ Flashing from Make .. _cmake set: https://cmake.org/cmake/help/v3.16/command/set.html .. _cmake string: https://cmake.org/cmake/help/v3.16/command/string.html .. _cmake faq generated files: https://gitlab.kitware.com/cmake/community/-/wikis/FAQ#how-can-i-generate-a-source-file-during-the-build -.. _ADDITIONAL_MAKE_CLEAN_FILES: https://cmake.org/cmake/help/v3.16/prop_dir/ADDITIONAL_MAKE_CLEAN_FILES.html +.. _ADDITIONAL_CLEAN_FILES: https://cmake.org/cmake/help/v3.16/prop_dir/ADDITIONAL_CLEAN_FILES.html .. _ExternalProject: https://cmake.org/cmake/help/v3.16/module/ExternalProject.html .. _cmake language variables: https://cmake.org/cmake/help/v3.16/manual/cmake-variables.7.html#variables-for-languages .. _set_source_files_properties: https://cmake.org/cmake/help/v3.16/command/set_source_files_properties.html diff --git a/docs/zh_CN/api-guides/build-system.rst b/docs/zh_CN/api-guides/build-system.rst index 70d6ccb93f..ac93133c37 100644 --- a/docs/zh_CN/api-guides/build-system.rst +++ b/docs/zh_CN/api-guides/build-system.rst @@ -926,7 +926,7 @@ ExternalProject 的依赖与构建清理 对于外部项目的构建,CMake 会有一些不同寻常的行为: -- `ADDITIONAL_MAKE_CLEAN_FILES`_ 仅在使用 Make 构建系统时有效。如果使用 Ninja_ 或 IDE 自带的构建系统,执行项目清理时,这些文件不会被删除。 +- `ADDITIONAL_MAKE_CLEAN_FILES`_ 仅在使用 Make 或 Ninja_ 构建系统时有效。如果使用 IDE 自带的构建系统,执行项目清理时,这些文件不会被删除。 - ExternalProject_ 会在 clean 运行后自动重新运行配置和构建命令。 - 可以采用以下两种方法来配置外部构建命令: diff --git a/tools/cmake/kconfig.cmake b/tools/cmake/kconfig.cmake index 968d3713a1..f10ea80fae 100644 --- a/tools/cmake/kconfig.cmake +++ b/tools/cmake/kconfig.cmake @@ -191,7 +191,7 @@ function(__kconfig_generate_config sdkconfig sdkconfig_defaults) set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${idf_path}/tools/kconfig_new/confgen.py") set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" APPEND PROPERTY - ADDITIONAL_MAKE_CLEAN_FILES "${sdkconfig_header}" "${sdkconfig_cmake}") + ADDITIONAL_CLEAN_FILES "${sdkconfig_header}" "${sdkconfig_cmake}") idf_build_set_property(SDKCONFIG_HEADER ${sdkconfig_header}) idf_build_set_property(SDKCONFIG_JSON ${sdkconfig_json}) diff --git a/tools/cmake/ldgen.cmake b/tools/cmake/ldgen.cmake index 54b10bc91f..ffb3f4504f 100644 --- a/tools/cmake/ldgen.cmake +++ b/tools/cmake/ldgen.cmake @@ -37,7 +37,7 @@ function(__ldgen_process_template template output) file(GENERATE OUTPUT ${build_dir}/ldgen_libraries INPUT ${build_dir}/ldgen_libraries.in) set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" - APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES + APPEND PROPERTY ADDITIONAL_CLEAN_FILES "${build_dir}/ldgen_libraries.in" "${build_dir}/ldgen_libraries") diff --git a/tools/cmake/project.cmake b/tools/cmake/project.cmake index fd81d7eff6..da4e8fdb02 100644 --- a/tools/cmake/project.cmake +++ b/tools/cmake/project.cmake @@ -583,7 +583,7 @@ macro(project project_name) endif() set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" APPEND PROPERTY - ADDITIONAL_MAKE_CLEAN_FILES + ADDITIONAL_CLEAN_FILES "${mapfile}" "${project_elf_src}") idf_build_get_property(idf_path IDF_PATH) diff --git a/tools/cmake/utilities.cmake b/tools/cmake/utilities.cmake index 9d1a301b9f..11af9044e0 100644 --- a/tools/cmake/utilities.cmake +++ b/tools/cmake/utilities.cmake @@ -103,7 +103,7 @@ function(target_add_binary_data target embed_file embed_type) WORKING_DIRECTORY "${build_dir}" VERBATIM) - set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${embed_srcfile}") + set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" APPEND PROPERTY ADDITIONAL_CLEAN_FILES "${embed_srcfile}") target_sources("${target}" PRIVATE "${embed_srcfile}") endfunction() @@ -330,7 +330,7 @@ function(file_generate output) endif() set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" - APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${output}") + APPEND PROPERTY ADDITIONAL_CLEAN_FILES "${output}") endfunction() # add_subdirectory_if_exists