[Openmp-commits] [PATCH] D159161: [openmp] Tighten flang detection in offloading test

Ethan Luis McDonough via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Tue Aug 29 21:35:21 PDT 2023


elmcdonough created this revision.
elmcdonough added reviewers: jdoerfert, jsjodin.
Herald added subscribers: guansong, yaxunl.
Herald added a reviewer: sscalpone.
Herald added a project: All.
elmcdonough requested review of this revision.
Herald added subscribers: openmp-commits, jplehr, sstefan1.
Herald added a project: OpenMP.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D159161

Files:
  openmp/CMakeLists.txt


Index: openmp/CMakeLists.txt
===================================================================
--- openmp/CMakeLists.txt
+++ openmp/CMakeLists.txt
@@ -56,9 +56,18 @@
     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,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D159161.554563.patch
Type: text/x-patch
Size: 980 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20230830/0713ae3a/attachment.bin>


More information about the Openmp-commits mailing list