[Openmp-commits] [openmp] [openmp] Allow testing OpenMP without a full clang build tree (PR #182470)

Martin Storsjö via Openmp-commits openmp-commits at lists.llvm.org
Fri Feb 20 05:14:36 PST 2026


================
@@ -41,12 +41,19 @@ else()
       "Path where built OpenMP libraries should be installed.")
 endif()
 
-if (NOT MSVC)
-  set(OPENMP_TEST_C_COMPILER ${LLVM_TOOLS_BINARY_DIR}/clang)
-  set(OPENMP_TEST_CXX_COMPILER ${LLVM_TOOLS_BINARY_DIR}/clang++)
+if (NOT TARGET "clang")
+  set(OPENMP_TEST_C_COMPILER ${CMAKE_C_COMPILER} CACHE STRING
+    "C compiler to use for testing OpenMP runtime libraries.")
+  set(OPENMP_TEST_CXX_COMPILER ${CMAKE_CXX_COMPILER} CACHE STRING
+    "C++ compiler to use for testing OpenMP runtime libraries.")
 else()
-  set(OPENMP_TEST_C_COMPILER ${LLVM_TOOLS_BINARY_DIR}/clang.exe)
-  set(OPENMP_TEST_CXX_COMPILER ${LLVM_TOOLS_BINARY_DIR}/clang++.exe)
+  if (NOT MSVC)
+    set(OPENMP_TEST_C_COMPILER ${LLVM_TOOLS_BINARY_DIR}/clang)
+    set(OPENMP_TEST_CXX_COMPILER ${LLVM_TOOLS_BINARY_DIR}/clang++)
+  else()
+    set(OPENMP_TEST_C_COMPILER ${LLVM_TOOLS_BINARY_DIR}/clang.exe)
+    set(OPENMP_TEST_CXX_COMPILER ${LLVM_TOOLS_BINARY_DIR}/clang++.exe)
+  endif()
----------------
mstorsjo wrote:

Yeah, something like that should work. I applied such a change, but keeping the existing logic of using `${LLVM_TOOLS_BINARY_DIR}/clang` rather than trying to use generator expressions here. (Such a change can be made later as a separate step if you feel like it.)

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


More information about the Openmp-commits mailing list