cmake: add app boards subdir as search location for board overlay files

Putting overlay files in the test/sample root clutters the file
system.  Allow them to be in the boards subdirectory alongside
board.conf files.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
This commit is contained in:
Peter Bigot 2019-09-24 07:16:27 -05:00 committed by Kumar Gala
parent 89a984e644
commit 0582a0c1bf
2 changed files with 13 additions and 13 deletions

View file

@ -422,6 +422,8 @@ if(DTC_OVERLAY_FILE)
# variable DTC_OVERLAY_FILE
elseif(DEFINED ENV{DTC_OVERLAY_FILE})
set(DTC_OVERLAY_FILE $ENV{DTC_OVERLAY_FILE})
elseif(EXISTS ${APPLICATION_SOURCE_DIR}/boards/${BOARD}.overlay)
set(DTC_OVERLAY_FILE ${APPLICATION_SOURCE_DIR}/boards/${BOARD}.overlay)
elseif(EXISTS ${APPLICATION_SOURCE_DIR}/${BOARD}.overlay)
set(DTC_OVERLAY_FILE ${APPLICATION_SOURCE_DIR}/${BOARD}.overlay)
elseif(EXISTS ${APPLICATION_SOURCE_DIR}/app.overlay)

View file

@ -1532,20 +1532,18 @@ the C preprocessor on a file which includes the following:
#. Any file or files given by the :makevar:`DTC_OVERLAY_FILE` CMake
variable.
The Zephyr build system determines :makevar:`DTC_OVERLAY_FILE` as
follows:
The Zephyr build system determines the ``DTC_OVERLAY_FILE`` value by
looking at these potential definition locations, in order, until a value
is determined, and then stops looking:
- Any value given to :makevar:`DTC_OVERLAY_FILE` in your application
:file:`CMakeLists.txt` (**before including the boilerplate.cmake file**),
passed to the the CMake command line, or present in the CMake variable cache,
takes precedence.
- The :ref:`environment variable <env_vars>` :envvar:`DTC_OVERLAY_FILE` is
checked next. This mechanism is now deprecated; users should set this
variable using CMake instead of the environment.
- If the file :file:`BOARD.overlay` exists in your application directory,
where ``BOARD`` is the BOARD value set earlier, it will be used.
1. the cmake command line (``-DDTC_OVERLAY_FILE=filename``)
#. the cmake variable cache (from a previous cmake run)
#. a ``CMakeLists.txt`` file in your application folder
#. a ``DTC_OVERLAY_FILE`` environment variable (deprecated)
#. a ``boards/<BOARD>.overlay`` file in your application folder,
for your specified ``<BOARD>``
#. a ``<BOARD>.overlay`` file in your application folder, for
your specified ``<BOARD>``
If :makevar:`DTC_OVERLAY_FILE` specifies multiple files, they are
included in order by the C preprocessor.