[clang] [compiler-rt] [llvm] [CMake] Use Clang to infer the target triple (PR #89425)

YunQiang Su via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 19 17:09:21 PDT 2024


================
@@ -28,6 +28,19 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
   if (NOT LLVM_RUNTIMES_BUILD)
     load_llvm_config()
   endif()
+  if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
+    set(print_target_triple ${CMAKE_CXX_COMPILER} --target=${LLVM_RUNTIME_TRIPLE} -print-target-triple)
----------------
wzssyqa wrote:

I am wondering that whether `CMAKE_CXX_COMPILER` is defined for `compiler-rt/lib/builtins`.
All source of this library is pure C/ASM.

In fact when I worked on my PR, I did meet this problem.
My configure cmd is
```
cmake ../llvm -G Ninja -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=off -DLLVM_DEFAULT_TARGET_TRIPLE=aarch64-linux-gnu -DLLVM_USE_LINKER=lld -DLLVM_ENABLE_RUNTIMES="compiler-rt;libunwind" -DLLVM_ENABLE_PROJECTS="mlir;clang;clang-tools-extra;lld" -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=RelWithDebInfo
```

https://github.com/llvm/llvm-project/pull/89425


More information about the cfe-commits mailing list