-
Notifications
You must be signed in to change notification settings - Fork 8.4k
cmake: Fix warning if a Zephyr library is created in app-mode #91143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmake: Fix warning if a Zephyr library is created in app-mode #91143
Conversation
zephyr_append_cmake_library attempts to warn the user if a user calls it to create a Zephyr library while the build is in application mode. At that stage of the build, the list of Zephyr libraries has already been processed so the function is effectively a no-op. This heuristic used to determine if the build was in kernel mode or application mode checked for the presence of the zephyr_prebuilt target. This check was broken by a previous commit that renamed this target. This commit fixes the heuristic by checking for the zephyr_pre0 target. This was tested by calling zephyr_append_cmake_library from some application build files, building the application, and seeing the warning only for the call I added. No warnings were printed for any Zephyr internal libraries. Link: zephyrproject-rtos#35887 Link: zephyrproject-rtos#39959 Signed-off-by: Kesavan Yogeswaran <hikes@google.com>
|
zephyr_append_cmake_library is effectively a no-op in the "application stage" of the Zephyr build. It is only useful inside of Zephyr and in Zephyr modules. References * zephyrproject-rtos/zephyr#35887 * zephyrproject-rtos/zephyr#91143 Change-Id: Ie766d8d720e3e9cb1c4282cc7fa04517f9904055 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/296772 Commit-Queue: Kesavan Yogeswaran <hikes@google.com> Pigweed-Auto-Submit: Kesavan Yogeswaran <hikes@google.com> Lint: Lint 🤖 <android-build-ayeaye@system.gserviceaccount.com> Reviewed-by: Yuval Peress <peress@google.com> Reviewed-by: Wyatt Hepler <hepler@google.com> Docs-Not-Needed: Kesavan Yogeswaran <hikes@google.com> Presubmit-Verified: CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>
|
With this change, we are now receiving warnings in our CMake build when using the Is this warning expected for our use case, or is there an exception that should be applied to prevent the warning when using Or what is the recommended way to build static libraries (without using zephyr modules)? |
Can you explain what you mean, you are using a zephyr build to generate static libraries that you then use somewhere else in a different project? |
I have created a separate discussion for my question in order to not abuse this PR for discussions: |



zephyr_append_cmake_libraryattempts to warn the user if a user calls it to create a Zephyr library while the build is in application mode. At that stage of the build, the list of Zephyr libraries has already been processed so the function is effectively a no-op. This warning originated from #35887.This heuristic used to determine if the build was in kernel mode or application mode checked for the presence of the
zephyr_prebuilttarget. This check was broken by a previous commit (#39959) that renamed this target.This commit fixes the heuristic by checking for the
zephyr_pre0target instead of thezephyr_prebuilttarget.This was tested by calling
zephyr_append_cmake_libraryfrom some application build files, building the application, and seeing the warning only for the call I added. No warnings were printed for any Zephyr internal libraries.