From ba905d045b97a437fbd82f8c91204ef5caa2a96b Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Wed, 25 Jun 2025 10:06:40 +0200 Subject: [PATCH] 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 --- cmake/modules/extensions.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmake/modules/extensions.cmake b/cmake/modules/extensions.cmake index 7583f13598f..8432b3a0a26 100644 --- a/cmake/modules/extensions.cmake +++ b/cmake/modules/extensions.cmake @@ -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})