cmake: add a mechanism for deprecating modules

We currently have mechanisms for deprecating both boards and SoCs.
However, we lack one for deprecating modules. This is inconvenient,
because we would like to do exactly that.

Handle this in a simple way by adding a new CMake file in the modules
directory which is responsible for warning the user about any
deprecated modules they may be using. See the source code comments for
more details about the approach.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This commit is contained in:
Martí Bolívar 2022-05-26 14:00:45 -07:00 committed by Marti Bolivar
commit dcec8d028a
2 changed files with 15 additions and 0 deletions

View file

@ -1824,6 +1824,8 @@ if(CONFIG_SOC_DEPRECATED_RELEASE)
) )
endif() endif()
include(modules/deprecation_warnings.cmake)
# In CMake projects, 'CMAKE_BUILD_TYPE' usually determines the # In CMake projects, 'CMAKE_BUILD_TYPE' usually determines the
# optimization flag, but in Zephyr it is determined through # optimization flag, but in Zephyr it is determined through
# Kconfig. Here we give a warning when there is a mismatch between the # Kconfig. Here we give a warning when there is a mismatch between the

View file

@ -0,0 +1,13 @@
# Copyright 2022 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
# This file is included to warn the user about any deprecated modules
# they are using. To create a warning, follow the pattern:
#
# if(CONFIG_FOO)
# message(WARNING "The foo module is deprecated. <More information>")
# endif()
#
# This is done in a separate CMake file because the modules.cmake file
# in this same directory is evaluated before Kconfig runs.