cmake: extensions: Check no arguments are given to zephyr_library

The zephyr_library macro does not expect any arguments, add a check for
that and similar for zephyr_library_named for no unexpected additional
arguments.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
This commit is contained in:
Pieter De Gendt 2025-06-25 10:06:40 +02:00 committed by Benjamin Cabé
parent 775696c297
commit ba905d045b

View File

@ -428,6 +428,8 @@ endmacro()
# Constructor with a directory-inferred name
macro(zephyr_library)
zephyr_check_no_arguments(zephyr_library ${ARGN})
zephyr_library_get_current_dir_lib_name(${ZEPHYR_BASE} lib_name)
zephyr_library_named(${lib_name})
endmacro()
@ -452,6 +454,8 @@ endmacro()
# Constructor with an explicitly given name.
macro(zephyr_library_named name)
zephyr_check_no_arguments(zephyr_library_named ${ARGN})
# This is a macro because we need add_library() to be executed
# within the scope of the caller.
set(ZEPHYR_CURRENT_LIBRARY ${name})