File: cpp_bindgen_fortran_helpers.cmake

package info (click to toggle)
gridtools 2.3.9-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 29,480 kB
  • sloc: cpp: 228,792; python: 17,561; javascript: 9,164; ansic: 4,101; sh: 850; makefile: 231; f90: 201
file content (19 lines) | stat: -rw-r--r-- 935 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
function(bindgen_enable_fortran_openacc_on_target target)
    # TODO check if find_package(OpenACC) solves this problem
    if(CMAKE_Fortran_COMPILER_ID STREQUAL "Cray")
        target_compile_options(${target} PRIVATE $<$<COMPILE_LANGUAGE:Fortran>:-h acc>)
    elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
        target_compile_options(${target} PRIVATE $<$<COMPILE_LANGUAGE:Fortran>:-fopenacc>)
        set_target_properties(${target} PROPERTIES APPEND_STRING PROPERTY LINK_FLAGS -fopenacc)
    else()
        message(FATAL_ERROR "OpenACC is not configured for this compiler.")
    endif()
endfunction()

function(bindgen_enable_fortran_preprocessing_on_target target)
    if (CMAKE_Fortran_COMPILER_ID STREQUAL "Cray")
        target_compile_options(${target} PRIVATE $<$<COMPILE_LANGUAGE:Fortran>:-eF>)
    else()
        target_compile_options(${target} PRIVATE $<$<COMPILE_LANGUAGE:Fortran>:-cpp>)
    endif()
endfunction()