Skip to content
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

Revert breaking change to CMAKE_SYSTEM_NAME and unnecessary introduction of cmake/modules/Platform/Zephyr.cmake #71468

Merged
merged 1 commit into from
Apr 29, 2024

Commits on Apr 25, 2024

  1. cmake: Revert breaking change to CMAKE_SYSTEM_NAME

    This commit reverts a breaking change in CMAKE_SYSTEM_NAME introduced by
    "Zephyr" back to "Generic") and removes the file
    `cmake/modules/Platform/Zephyr`.
    
    Both changes in the aforementioned PR were only introduced to ultimately
    modify the value of the global CMake property TARGET_SUPPORTS_SHARED_LIBS
    for the special case of building for Xtensa with LLEXT.
    
    The modification of CMAKE_SYSTEM_NAME is considered a breaking change
    because it has the potential to alter the build of any non-trivial project
    that previously checked for the "Generic" system identifier as
    corresponding to Zephyr - for example by doing
    `if (CMAKE_SYSTEM_NAME STREQUAL "Generic")`. Such builds may now break in
    many ways including silently when there is no `else()` clause with a
    `message()` to alert the user that a whole configuration block had been
    skipped.
    
    In essence, that CMAKE_SYSTEM_NAME modification was only introduced in
    order to have CMake to load `cmake/modules/Platform/Zephyr.cmake` which in
    turn adjusted the value of TARGET_SUPPORTS_SHARED_LIBS.
    
    But the use of a CMake platform file like this is ineffective for
    non-trivial projects where one or more top level CMake `project()` calls
    may happen before the first call to `find_package(Zephyr)` because in such
    cases CMAKE_MODULE_PATH will not have been modified yet to contain the
    path to <Zephyr_ROOT>/cmake/modules and thus no platform file will be
    include by CMake.
    
    This patch moves the conditional override of TARGET_SUPPORTS_SHARED_LIBS
    needed by some archs (e.g. Xtensa) into the `kernel.cmake` module which
    is known to be the first call to `project()` that enables any language and
    thus the one that must come before any artifact target can be defined.
    
    Note commit 64e7d85 added a Kconfig to specify the object type of llext
    being built, so it's not tied to the arch anymore but to the
    CONFIG_LLEXT_TYPE_ELF_SHAREDLIB option.
    
    Signed-off-by: Nicolas Lebedenco <nicolas@lebedenco.net>
    nlebedenco committed Apr 25, 2024
    Configuration menu
    Copy the full SHA
    0b9d9d3 View commit details
    Browse the repository at this point in the history