mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-08 04:02:27 +00:00
build-system: replace ADDITIONAL_MAKE_CLEAN_FILES with ADDITIONAL_CLEAN_FILES
ADDITIONAL_MAKE_CLEAN_FILES is deprecated and only worked with make. Replaced with the new ADDITIONAL_CLEAN_FILES (CMake 3.15) which also works with ninja.
This commit is contained in:
@@ -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 <cmake faq generated files_>`_, 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 <ADDITIONAL_MAKE_CLEAN_FILES_note>`.
|
||||
- ``COMPONENT_EXTRA_CLEAN``: Set property ``ADDITIONAL_CLEAN_FILES`` instead but note :ref:`CMake has some restrictions around this functionality <ADDITIONAL_CLEAN_FILES_note>`.
|
||||
- ``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
|
||||
|
Reference in New Issue
Block a user