cmake: FindBabbleSim: Ensure BSIM variables are available everywhere#104598
Open
aescolar wants to merge 1 commit intozephyrproject-rtos:mainfrom
Open
cmake: FindBabbleSim: Ensure BSIM variables are available everywhere#104598aescolar wants to merge 1 commit intozephyrproject-rtos:mainfrom
aescolar wants to merge 1 commit intozephyrproject-rtos:mainfrom
Conversation
0d25d0c to
c5cc01b
Compare
nordicjm
previously approved these changes
Feb 26, 2026
tejlmand
reviewed
Feb 26, 2026
cmake/modules/FindBabbleSim.cmake
Outdated
Comment on lines
67
to
68
| set(BSIM_COMPONENTS_PATH ${BSIM_COMPONENTS_PATH} CACHE PATH "BabbleSim components folder") | ||
| set(BSIM_OUT_PATH ${BSIM_OUT_PATH} CACHE PATH "BabbleSim build output folder") |
Contributor
There was a problem hiding this comment.
the zephyr_get() here:
zephyr/cmake/modules/FindBabbleSim.cmake
Lines 21 to 22 in 69f3a44
will set those variables in local scope, meaning all code executed as part of find_package(Zephyr) will have those variable available as both env vars and normal CMake variables even if this code is not added.
Only code invoked in a CMake external project, or after find_package(Zephyr) may not have them available (depending on how they were set initially)
c5cc01b to
068751d
Compare
nordicjm
reviewed
Feb 26, 2026
cmake/modules/FindBabbleSim.cmake
Outdated
| # | ||
| # If BabbleSim cannot be found we error right away with a message trying to guide users | ||
|
|
||
| if (DEFINED CACHE{BabbleSim_FOUND}) |
Contributor
There was a problem hiding this comment.
Suggested change
| if (DEFINED CACHE{BabbleSim_FOUND}) | |
| if(DEFINED CACHE{BabbleSim_FOUND}) |
Ensure the two BSIM variables BSIM_OUT_PATH and BSIM_COMPONENTS_PATH are available everywhere also as a cmake variable as quite a few apps use them. (Some apps try to get them as an environment var, some as a cmake var). When the user had them set in the environment, and the BabbleSim module uses zephyr_get() to try to find them, this also sets them globally. But otherwise, if we just deduced them in this module, we were only setting them in the enviroment, so apps which expected them globally would not build properly. As bonus, add a cache variable to mark the module as found, so if find_package(BabbleSim) is called again, we just skip it. Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
068751d to
e35208a
Compare
nordicjm
approved these changes
Feb 26, 2026
|
❌ The last analysis has failed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ensure the two BSIM variables BSIM_OUT_PATH and BSIM_COMPONENTS_PATH are available everywhere also as a cmake variable as quite a few apps use them. (Some apps try to get them as an environment var, some as a cmake var).
When the user had them set in the environment, and the BabbleSim module uses zephyr_get() to try to find them, this also sets them globally. But otherwise, if we just deduced them in this module, we were only setting them in the enviroment, so apps which expected them globally would not build properly.
As bonus, add a cache variable to mark the module as found, so if
find_package(BabbleSim) is called again, we just skip it.