[memprof] Upgrade a unit test to MemProf Version 3 (#117063)
[llvm-project.git] / openmp / runtime / cmake / LibompCheckFortranFlag.cmake
blob344389f989388168fe82861f8a25a92004551278
2 #//===----------------------------------------------------------------------===//
3 #//
4 #// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 #// See https://llvm.org/LICENSE.txt for license information.
6 #// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 #//
8 #//===----------------------------------------------------------------------===//
11 # Checking a fortran compiler flag
12 # There is no real trivial way to do this in CMake, so we implement it here
13 # this will have ${boolean} = TRUE if the flag succeeds, otherwise false.
14 function(libomp_check_fortran_flag flag boolean)
15   if(NOT DEFINED "${boolean}")
16     set(retval TRUE)
17     set(fortran_source
18 "      program hello
19            print *, \"Hello World!\"
20       end program hello")
22     # Compiling as a part of runtimes introduces ARCH-unknown-linux-gnu as a
23     # part of a working directory.  So adding a guard for unknown.
24     set(failed_regexes "[Ee]rror;[Uu]nknown[^-];[Ss]kipping")
25     include(CheckFortranSourceCompiles)
26     check_fortran_source_compiles("${fortran_source}" ${boolean} FAIL_REGEX "${failed_regexes}")
27     set(${boolean} ${${boolean}} PARENT_SCOPE)
28   endif()
29 endfunction()