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

Ensure that the choice of compiler and target is passed to sub-projects. #17732

Merged
merged 1 commit into from
May 24, 2024

Commits on May 22, 2024

  1. Ensure that the choice of compiler and target is passed to sub-projects.

    If not explicitly set using exported environment variables, the choice
    of compilers and compiler targets used by CMake does not get propagated
    to sub-porjects created with ExternalProject_Add or
    FetchContent_Declare.
    
    In most cases this does not matter, because very few people are building
    using non-default compilers for their environment, but it can cause
    issues in two specific cases:
    
    - If building for the same system that the build is happening on, but
      using a non-default compiler specified using CMake arguments (instead
      of via exported environment variables), sub-projects will still use
      the default compiler for the system, which may result in linking
      errors (or runtime failures even if the link succeeds).
    - If cross-compiling and not using the preferred approaches of either a
      toolchain file or exported environment variables, sub-projects may not
      even build for the correct CPU architecture, causing the build to
      fail.
    
    This adds logic to ensure that the compiler and compiler targets get
    propagated correctly even if they are just specified on the command
    line, thus avoiding the above two possibilities.
    Ferroin committed May 22, 2024
    Configuration menu
    Copy the full SHA
    e826922 View commit details
    Browse the repository at this point in the history