• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#
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#//===----------------------------------------------------------------------===//
9#
10
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.
14function(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")
21
22    set(failed_regexes "[Ee]rror;[Uu]nknown;[Ss]kipping")
23    include(CheckFortranSourceCompiles)
24    check_fortran_source_compiles("${fortran_source}" ${boolean} FAIL_REGEX "${failed_regexes}")
25    set(${boolean} ${${boolean}} PARENT_SCOPE)
26  endif()
27endfunction()
28