
macro(determine_openacc)
if ("${OPENACC_LIST}" STREQUAL "")
  SET(OPENACC_LIST GNU;PGI;NVHPC)
endif()
SET(DO_OPENACC FALSE)
list(FIND OPENACC_LIST ${CMAKE_Fortran_COMPILER_ID} _ind)
if( ${_ind} GREATER -1 )
  SET(DO_OPENACC TRUE)
  if ("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "GNU" AND ${CMAKE_Fortran_COMPILER_VERSION} LESS 8 )
    SET(DO_OPENACC FALSE)
  endif()
  if ("${OPENACC_FLAGS}" STREQUAL "")
    SET(DO_OPENACC FALSE)
  endif()
endif()
if (${DO_OPENACC})
  MESSAGE(STATUS "*** Compiling OpenACC code with ${CMAKE_Fortran_COMPILER_ID} ${CMAKE_Fortran_COMPILER_VERSION} using the flags: ${OPENACC_FLAGS}")
else() 
  MESSAGE(STATUS "*** OpenACC code will not be compiled.")
endif()
endmacro(determine_openacc)



macro(determine_openmp45)
if ("${OPENMP45_LIST}" STREQUAL "")
  SET(OPENMP45_LIST XL;GNU)
endif()
SET(DO_OPENMP45 FALSE)
list(FIND OPENMP45_LIST ${CMAKE_Fortran_COMPILER_ID} _ind)
if( ${_ind} GREATER -1 )
  SET(DO_OPENMP45 TRUE)
  if ("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "GNU" AND ${CMAKE_Fortran_COMPILER_VERSION} LESS 8)
    SET(DO_OPENMP45 FALSE)
  endif()
  if ("${OPENMP45_FLAGS}" STREQUAL "")
    SET(DO_OPENMP45 FALSE)
  endif()
endif()
if (${DO_OPENMP45})
  MESSAGE(STATUS "*** Compiling OpenMP45 code with ${CMAKE_Fortran_COMPILER_ID} ${CMAKE_Fortran_COMPILER_VERSION} using the flags: ${OPENMP45_FLAGS}")
else() 
  MESSAGE(STATUS "*** OpenMP4.5 code will not be compiled.")
endif()
endmacro(determine_openmp45)



macro(determine_do_concurrent)
if ("${DO_CONCURRENT_LIST}" STREQUAL "")
  SET(DO_CONCURRENT_LIST NVHPC;PGI)
endif()
SET(DO_DO_CONCURRENT FALSE)
list(FIND DO_CONCURRENT_LIST ${CMAKE_Fortran_COMPILER_ID} _ind)
if( ${_ind} GREATER -1 )
  SET(DO_DO_CONCURRENT TRUE)
  if ("${DO_CONCURRENT_FLAGS}" STREQUAL "")
    SET(DO_DO_CONCURRENT FALSE)
  endif()
endif()
if (${DO_DO_CONCURRENT})
  MESSAGE(STATUS "*** Compiling do concurrent code with ${CMAKE_Fortran_COMPILER_ID} ${CMAKE_Fortran_COMPILER_VERSION} using the flags: ${DO_CONCURRENT_FLAGS}")
else() 
  MESSAGE(STATUS "*** Do concurrent code will not be compiled.")
endif()
endmacro(determine_do_concurrent)


