brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · 344389f Raw
30 lines · plain
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-exception7#//8#//===----------------------------------------------------------------------===//9#10 11# Checking a fortran compiler flag12# There is no real trivial way to do this in CMake, so we implement it here13# 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_source18"      program hello19           print *, \"Hello World!\"20      end program hello")21 22    # Compiling as a part of runtimes introduces ARCH-unknown-linux-gnu as a23    # 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()29endfunction()30