[llvm] [CMake] Handle clang in MSVC mode in GetHostTriple (PR #116701)

Omair Javaid via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 26 06:56:32 PST 2024


================
@@ -2,7 +2,7 @@
 # Invokes config.guess
 
 function( get_host_triple var )
-  if( MSVC )
+  if( MSVC OR (CMAKE_SYSTEM_NAME STREQUAL "Windows" AND CMAKE_C_COMPILER_ID MATCHES "Clang" AND NOT MINGW AND NOT MSYS))
----------------
omjavaid wrote:

IMO, this if condition should be organized something like following:
```cmake
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
    if(CMAKE_C_COMPILER_ID MATCHES "Clang")
        if(MSVC)
            message(STATUS "Clang is operating in MSVC mode (MSVC style driver: clang-cl).")
        elseif(CMAKE_C_COMPILER_ARCHITECTURE_ID)
            message(STATUS "Clang is operating in MSVC mode (GNU style driver).")
        else()
            message(STATUS "Clang MinGW mode")
        endif()
    elseif(MSVC)
        message(STATUS "Compiler is MSVC (cl compiler).")
endif()

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


More information about the llvm-commits mailing list