[Openmp-commits] [openmp] 2b6ba8c - [openmp] Tighten flang detection in offloading test

Ethan Luis McDonough via Openmp-commits openmp-commits at lists.llvm.org
Fri Sep 1 11:59:23 PDT 2023


Author: Ethan Luis McDonough
Date: 2023-09-01T13:59:18-05:00
New Revision: 2b6ba8c7354e180705f4b17324a0fdac68350581

URL: https://github.com/llvm/llvm-project/commit/2b6ba8c7354e180705f4b17324a0fdac68350581
DIFF: https://github.com/llvm/llvm-project/commit/2b6ba8c7354e180705f4b17324a0fdac68350581.diff

LOG: [openmp] Tighten flang detection in offloading test

This patch ensures that the locally built version of flang when building in-tree.  `find_program` sometimes used the wrong executable if a different copy of flang was installed.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D159161

Added: 
    

Modified: 
    openmp/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/openmp/CMakeLists.txt b/openmp/CMakeLists.txt
index c3338137479f33..13e65bf70b5bb5 100644
--- a/openmp/CMakeLists.txt
+++ b/openmp/CMakeLists.txt
@@ -56,9 +56,18 @@ else()
     set(OPENMP_TEST_CXX_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++.exe)
   endif()
 
-  find_program(OPENMP_TEST_Fortran_COMPILER flang-new PATHS LLVM_RUNTIME_OUTPUT_INTDIR)
-  if (NOT OPENMP_TEST_Fortran_COMPILER)
-    unset(OPENMP_TEST_Fortran_COMPILER CACHE)
+  # Check for flang
+  if (NOT MSVC)
+    set(OPENMP_TEST_Fortran_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/flang-new)
+  else()
+    set(OPENMP_TEST_Fortran_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/flang-new.exe)
+  endif()
+
+  # Set fortran test compiler if flang is found
+  if (EXISTS "${OPENMP_TEST_Fortran_COMPILER}")
+    message("Using local flang build at ${OPENMP_TEST_Fortran_COMPILER}")
+  else()
+    unset(OPENMP_TEST_Fortran_COMPILER)
   endif()
 
   # If not standalone, set CMAKE_CXX_STANDARD but don't set the global cache value,


        


More information about the Openmp-commits mailing list