cmake: Deprecate 'set_conf_file'

In-tree, all usage of 'set_conf_file' is implementing the same
pattern (with some inconsequential differences).

To reduce copy-paste and get closer to dropping support for
'set_conf_file', we include this pattern into the built-in set of
patterns.

'set_conf_file' is causing issues for future extensions,
e.g. multi-image support, and is also the source of a lot of
duplicated code.

Note support for 'set_conf_file' is not dropped, it is only marked as
deprecated.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
This commit is contained in:
Sebastian Bøe 2019-02-28 14:53:48 +01:00 committed by Anas Nashif
commit 6d4ba3490f
2 changed files with 9 additions and 5 deletions

View file

@ -338,11 +338,15 @@ elseif(DEFINED ENV{CONF_FILE})
set(CONF_FILE $ENV{CONF_FILE})
elseif(COMMAND set_conf_file)
message(WARNING "'set_conf_file' is deprecated, it will be removed in a future release.")
set_conf_file()
elseif(EXISTS ${APPLICATION_SOURCE_DIR}/prj_${BOARD}.conf)
set(CONF_FILE ${APPLICATION_SOURCE_DIR}/prj_${BOARD}.conf)
elseif(EXISTS ${APPLICATION_SOURCE_DIR}/boards/${BOARD}.conf)
set(CONF_FILE ${APPLICATION_SOURCE_DIR}/prj.conf ${APPLICATION_SOURCE_DIR}/boards/${BOARD}.conf)
elseif(EXISTS ${APPLICATION_SOURCE_DIR}/prj.conf)
set(CONF_FILE ${APPLICATION_SOURCE_DIR}/prj.conf)
endif()

View file

@ -1163,15 +1163,15 @@ file.
the configuration files specified in it are merged and used as the
application-specific settings.
Alternatively, an application may define a CMake command, macro, or function
called ``set_conf_file``, which is invoked and is expected to set
:makevar:`CONF_FILE`.
2. Otherwise (if (1.) does not apply), if a file :file:`prj_BOARD.conf` exists
in the application directory, where :makevar:`BOARD` is the BOARD value set
earlier, the settings in it are used.
3. Otherwise, if a file :file:`prj.conf` exists in the application directory,
3. Otherwise (if (2.) does not apply), if a file :file:`boards/BOARD.conf` exists
in the application directory, where :makevar:`BOARD` is the BOARD value set
earlier, the settings in it are merged with :file:`prj.conf` and used.
4. Otherwise, if a file :file:`prj.conf` exists in the application directory,
the settings in it are used.
Configuration settings that have not been specified fall back on their