
Updated version of #134990 which was reverted because of the buildbot [openmp-offload-amdgpu-runtime-2](https://lab.llvm.org/buildbot/#/builders/10) failing. Its configuration has `LLVM_ENABLE_LIBCXX=ON` set although it does not even have libc++ installed. In addition to #134990, this PR adds a check whether C++ libraries are actually available. `#include <chrono>` was chosen because this is the library that [openmp-offload-amdgpu-runtime-2 failed with](https://github.com/llvm/llvm-project/pull/134990#issuecomment-2792138162). Original summary: The buidbot [flang-aarch64-libcxx](https://lab.llvm.org/buildbot/#/builders/89) is currently failing with an ABI issue. The suspected reason is that LLVMSupport.a is built using libc++, but the unittests are using the default C++ standard library, libstdc++ in this case. This predefined `llvm_gtest` target uses the LLVMSupport from `find_package(LLVM)`, which finds the libc++-built LLVMSupport. To fix, store the `LLVM_ENABLE_LIBCXX` setting in the LLVMConfig.cmake such that everything that links to LLVM libraries use the same standard library. In this case discussed in https://github.com/llvm/llvm-zorg/pull/387 it was the flang-rt unittests, but other runtimes with GTest unittests should have the same issue (e.g. offload), and any external project that uses `find_package(LLVM)`. This patch fixed the problem for me locally.
The LLVM Compiler Infrastructure ================================ This directory and its subdirectories contain source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and runtime environments. LLVM is open source software. You may freely distribute it under the terms of the license agreement found in LICENSE.txt. Please see the documentation provided in docs/ for further assistance with LLVM, and in particular docs/GettingStarted.rst for getting started with LLVM and docs/README.txt for an overview of LLVM's documentation setup. If you are writing a package for LLVM, see docs/Packaging.rst for our suggestions.