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>
Loading
Please sign in to comment