[PATCH] D109837: cmake: Deprecate config.guess

Harald van Dijk via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 15 11:00:37 PDT 2021


hvdijk added a comment.

Thanks for suggesting this approach, I was not looking forward to having a massive CMake recreation of `config.guess`, this is a nice way to avoid duplicating all the detection.



================
Comment at: llvm/cmake/modules/GetHostTriple.cmake:57
       set( value ${TT_OUT} )
+    elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
+      execute_process(COMMAND ${CMAKE_CXX_COMPILER} -v
----------------
CMake if commands are special, see the warning at https://cmake.org/cmake/help/latest/command/if.html#variable-expansion.


================
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
----------------
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.


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