CMake: __config_site install location when using multilibs

Our team maintains a downstream embedded ARM toolchain. We are currently using the llvm/runtimes build method to use the just-built compiler to build libc++.

  • We’d like to build two versions (base + multilib) of libc++: One with an external thread API enabled, and one without.
  • We’ve set up two configs for libc++: the desired target triple, and the same target triple with a multilib tag and associated CMake overrides
  • __config_site defines _LIBCPP_HAS_THREAD_API_EXTERNAL
  • __config_site is configured into LIBCXX_GENERATED_INCLUDE_TARGET_DIR and installed into LIBCXX_INSTALL_INCLUDE_TARGET_DIR
  • The above _DIR variables are defined to be based off of LLVM_DEFAULT_TARGET_TRIPLE because LLVM_ENABLE_PER_TARGET_RUNTIME_DIR is defaulted to true

So, both builds will configure __config_site to the same location.

Is there an expected/supported method to avoid this issue with multilibs?

My initial thought is we’d need to turn off LLVM_ENABLE_PER_TARGET_RUNTIME_DIR and manually designate install areas for each configuration.

@phosek authored ⚙ D89013 [libcxx] Support per-target __config_site in per-target runtime build to make __config_site be per-target, and he may have ideas on making it per-multilib as well.

I introduced multilib support for __config_site in [runtimes] Correctly apply libdir subdir for multilib (#93354) · llvm/llvm-project@ed155f3 · GitHub. Right now this is only supported in the Fuchsia driver but adding support to other drivers such as BareMetal should be straightforward.

Thank you for implementing, just saw it yesterday!