cmake: hex: deprecate use of to_hex() and from_hex() utility functions

Since v3.13, CMake has supported math(... OUTPUT_FORMAT <format>) and 0x
prefixes on numbers, which together provides the same functionality as
to_hex() and from_hex() that we've previously maintained.

Users should switch to using math() instead, and our functions are now
marked as deprecated.

Signed-off-by: Attie Grande <attie.grande@argentum-systems.co.uk>
This commit is contained in:
Attie Grande 2024-01-16 17:24:54 +00:00 committed by Fabio Baltieri
parent 902751a19e
commit 20e2318b9f
1 changed files with 4 additions and 0 deletions

View File

@ -1,5 +1,9 @@
# SPDX-License-Identifier: Apache-2.0
# This code was deprecated after Zephyr v3.5.0
message(DEPRECATION "The to_hex() and from_hex() functions are deprecated. Please "
"use CMake's math(... OUTPUT_FORMAT <format>) instead.")
# from https://gist.github.com/korzo89/71a6de0f388f7cf8b349101b0134060c
function(from_hex HEX DEC)
string(SUBSTRING "${HEX}" 2 -1 HEX)