[PATCH] D109837: cmake: Deprecate config.guess

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 15 12:02:08 PDT 2021


MaskRay added a comment.

  % gcc -dumpmachine
  x86_64-linux-gnu
  % clang -dumpmachine
  x86_64-unknown-linux-gnu



================
Comment at: llvm/cmake/modules/GetHostTriple.cmake:58
+    elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
+      execute_process(COMMAND ${CMAKE_CXX_COMPILER} -v
+        RESULT_VARIABLE TT_RV
----------------
hvdijk wrote:
> When `CMAKE_CXX_COMPILER` is set using the `CXX` environment variable, and `CXX` contains multiple words, the remaining words are provided in `CMAKE_CXX_COMPILER_ARG1` and should also be included.  (Yes, despite the name, all words other than the first are stored in a single variable.) `CMAKE_CXX_FLAGS` may have been set from the `CXXFLAGS` environment variable.
> 
> Including these options can be useful when setting `CXX="clang++ -m32"` or `CXX=clang++ CXXFLAGS=-m32` or such.
> 
> That said, this only helps when the host compiler is clang, as `gcc -v`'s printed target is always the default target and does not get adjusted based on any `-m` options.
```
% gcc -dumpmachine
x86_64-linux-gnu
% gcc -dumpmachine -m32
x86_64-linux-gnu
% clang -dumpmachine
x86_64-unknown-linux-gnu
% clang -dumpmachine -m32
i386-unknown-linux-gnu
```

is probably better. If the user wants to control `x86_64-linux-gnu`, `x86_64-unknown-linux-gnu`, `x86_64-pc-linux-gnu`, the should specify `LLVM_HOST_TRIPLE` explicitly.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109837/new/

https://reviews.llvm.org/D109837



More information about the llvm-commits mailing list