[compiler-rt] [compiler-rt] Don't detect a versioned clang test compiler as GCC (PR #117812)

Saleem Abdulrasool via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 27 10:25:23 PST 2024


================
@@ -77,9 +77,9 @@ else()
   set(COMPILER_RT_TEST_CXX_COMPILER ${CMAKE_CXX_COMPILER} CACHE PATH "C++ Compiler to use for testing")
 endif()
 
-if("${COMPILER_RT_TEST_COMPILER}" MATCHES "clang[+]*$")
-  set(COMPILER_RT_TEST_COMPILER_ID Clang)
-elseif("${COMPILER_RT_TEST_COMPILER}" MATCHES "clang.*.exe$")
+if ("${COMPILER_RT_TEST_COMPILER}" STREQUAL ${CMAKE_C_COMPILER})
+  set(COMPILER_RT_TEST_COMPILER_ID "${CMAKE_C_COMPILER_ID}")
+elseif("${COMPILER_RT_TEST_COMPILER}" MATCHES "clang[^/]*$")
----------------
compnerd wrote:

The separator on other platforms may not be the same. Windows uses `\` as the canonical arc separator. HFS used `:` (which is the ADS delimiter on Windows). I think that if we want to do this, we might want to just give up and use [`get_filename_component`](https://cmake.org/cmake/help/git-master/command/get_filename_component.html) with `NAME_WE` or `NAME_WLE`.

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


More information about the llvm-commits mailing list