From dcec8d028a342eb8c40d00e02c0ccd96e6e97845 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=AD=20Bol=C3=ADvar?= Date: Thu, 26 May 2022 14:00:45 -0700 Subject: [PATCH] cmake: add a mechanism for deprecating modules MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- CMakeLists.txt | 2 ++ modules/deprecation_warnings.cmake | 13 +++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 modules/deprecation_warnings.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 656e0d3e71d..3406c0acc60 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1824,6 +1824,8 @@ if(CONFIG_SOC_DEPRECATED_RELEASE) ) endif() +include(modules/deprecation_warnings.cmake) + # In CMake projects, 'CMAKE_BUILD_TYPE' usually determines the # optimization flag, but in Zephyr it is determined through # Kconfig. Here we give a warning when there is a mismatch between the diff --git a/modules/deprecation_warnings.cmake b/modules/deprecation_warnings.cmake new file mode 100644 index 00000000000..4ed70222f78 --- /dev/null +++ b/modules/deprecation_warnings.cmake @@ -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. ") +# endif() +# +# This is done in a separate CMake file because the modules.cmake file +# in this same directory is evaluated before Kconfig runs. +