commit 92984acc52fb95566d9387948c2655507328438b
Author: Daniel Martinez <danielmartinez@cock.li>
Date:   Wed Jul 31 21:14:52 2024 -0400

    Allow flang-new binary to be specified for omp modules
    
    This allows the path of the flang-new binary to be specified as a
    cmake configuration.
    
    This is useful when cross compiling, as flang-new may exist
    on the build machine, which should be used instead of the host.
    
    For example, by passing "-DFLANG_NEW_NATIVE_EXE=/usr/bin/flang-new",
    that binary will be used instead of just built host compiler.

diff --git a/llvm/runtimes/CMakeLists.txt b/llvm/runtimes/CMakeLists.txt
index 42b1b86ebaad..41921aaeaeb2 100644
--- a/llvm/runtimes/CMakeLists.txt
+++ b/llvm/runtimes/CMakeLists.txt
@@ -522,7 +522,7 @@
   if("openmp" IN_LIST LLVM_ENABLE_RUNTIMES OR "offload" IN_LIST LLVM_ENABLE_RUNTIMES)
     if (${LLVM_TOOL_FLANG_BUILD})
       message(STATUS "Configuring build of omp_lib.mod and omp_lib_kinds.mod via flang")
-      set(LIBOMP_FORTRAN_MODULES_COMPILER "${CMAKE_BINARY_DIR}/bin/flang")
+      set(LIBOMP_FORTRAN_MODULES_COMPILER "${CMAKE_BINARY_DIR}/bin/flang" CACHE INTERNAL "")
       set(LIBOMP_MODULES_INSTALL_PATH "${CMAKE_INSTALL_INCLUDEDIR}/flang")
       # TODO: This is a workaround until flang becomes a first-class project
       # in llvm/CMakeList.txt.  Until then, this line ensures that flang is
