zephyr/modules/hal_nxp
Jason Yu 530f9163db modules: hal_nxp: mcux-sdk-ng: Fix cmake variable scope error
The CMakeLists.txt files in folders modules/hal_nxp/mcux/mcux-sdk-ng/*/
are loaded in modules/hal_nxp/mcux/mcux-sdk-ng/CMakeLists.txt using
cmake function `add_subdirectory`.

One issue is, when variables defined in one CMakeLists.txt are needed
by another CMakeLists.txt, then the variables need be exposed to parent
scope. This is not convenient.

Another issue is, to expose variables, the function `set_variable_ifdef`
sets the variables as global variables. The CMake global variables
named `CONFIG_xxx` will be collected by Kconfig, and results in build
fail.

The solution is:
1. Replace `add_subdirectory` with `include`, so that the variables will
be in the same file scope, don't need to expose them.
2. Modify the implementation of `set_variable_ifdef`, don't set
variables as global variables.

Resolves #88135

Signed-off-by: Jason Yu <zejiang.yu@nxp.com>
2025-04-09 19:34:10 +02:00
..
imx modules: hal_nxp: Move hal_nxp glue layer to zephyr repo 2025-03-26 16:26:34 +01:00
mcux modules: hal_nxp: mcux-sdk-ng: Fix cmake variable scope error 2025-04-09 19:34:10 +02:00
s32 modules: hal_nxp: Move hal_nxp glue layer to zephyr repo 2025-03-26 16:26:34 +01:00
CMakeLists.txt modules: hal_nxp: Move hal_nxp glue layer to zephyr repo 2025-03-26 16:26:34 +01:00
Kconfig modules: hal_nxp: Move hal_nxp glue layer to zephyr repo 2025-03-26 16:26:34 +01:00