Skip to content

Commit dcec8d0

Browse files
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 <[email protected]>
1 parent 0813966 commit dcec8d0

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1824,6 +1824,8 @@ if(CONFIG_SOC_DEPRECATED_RELEASE)
18241824
)
18251825
endif()
18261826

1827+
include(modules/deprecation_warnings.cmake)
1828+
18271829
# In CMake projects, 'CMAKE_BUILD_TYPE' usually determines the
18281830
# optimization flag, but in Zephyr it is determined through
18291831
# Kconfig. Here we give a warning when there is a mismatch between the

modules/deprecation_warnings.cmake

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright 2022 Nordic Semiconductor ASA
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# This file is included to warn the user about any deprecated modules
5+
# they are using. To create a warning, follow the pattern:
6+
#
7+
# if(CONFIG_FOO)
8+
# message(WARNING "The foo module is deprecated. <More information>")
9+
# endif()
10+
#
11+
# This is done in a separate CMake file because the modules.cmake file
12+
# in this same directory is evaluated before Kconfig runs.
13+

0 commit comments

Comments
 (0)