Skip to content

Commit 2b6ba8c

Browse files
[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
1 parent 685e190 commit 2b6ba8c

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

openmp/CMakeLists.txt

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,18 @@ else()
5656
set(OPENMP_TEST_CXX_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++.exe)
5757
endif()
5858

59-
find_program(OPENMP_TEST_Fortran_COMPILER flang-new PATHS LLVM_RUNTIME_OUTPUT_INTDIR)
60-
if (NOT OPENMP_TEST_Fortran_COMPILER)
61-
unset(OPENMP_TEST_Fortran_COMPILER CACHE)
59+
# Check for flang
60+
if (NOT MSVC)
61+
set(OPENMP_TEST_Fortran_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/flang-new)
62+
else()
63+
set(OPENMP_TEST_Fortran_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/flang-new.exe)
64+
endif()
65+
66+
# Set fortran test compiler if flang is found
67+
if (EXISTS "${OPENMP_TEST_Fortran_COMPILER}")
68+
message("Using local flang build at ${OPENMP_TEST_Fortran_COMPILER}")
69+
else()
70+
unset(OPENMP_TEST_Fortran_COMPILER)
6271
endif()
6372

6473
# If not standalone, set CMAKE_CXX_STANDARD but don't set the global cache value,

0 commit comments

Comments
 (0)