#============================================================================== # HELPER MACROS #============================================================================== include(SPIOUtils) #============================================================================== # GENERATE SOURCE FILES #============================================================================== SET(TEMPSRCF90 alloc_mod.F90) FOREACH(tempfile IN LISTS TEMPSRCF90) ADD_CUSTOM_COMMAND( OUTPUT ${tempfile} COMMAND ${SPIO_GENF90_PATH}/genf90.pl ${CMAKE_CURRENT_SOURCE_DIR}/${tempfile}.in > ${tempfile} DEPENDS ${tempfile}.in ) ENDFOREACH() SET(SRC check_mod.F90 gdecomp_mod.F90 kinds_mod.F90 namelist_mod.F90 testpio.F90 utils_mod.F90 ${TEMPSRCF90}) SET(WSSRC wstest.c) #============================================================================== # SET THE COMPILER OPTIONS #============================================================================== INCLUDE_DIRECTORIES(${PIO_INCLUDE_DIRS}) LINK_DIRECTORIES(${PIO_LIB_DIR}) #============================================================================== # FIND EXTERNAL LIBRARIES/DEPENDENCIES #============================================================================== # Find the MPI library if (PIO_USE_MPISERIAL) find_package (MPISERIAL COMPONENTS Fortran REQUIRED) else () find_package (MPI REQUIRED) endif () # Check for MPI Fortran module find_path(MPIMOD_PATH NAMES mpi.mod MPI.mod HINTS ${MPI_Fortran_INCLUDE_PATH}) if (PIO_ENABLE_TIMING) find_package (GPTL COMPONENTS Fortran_Perf QUIET) endif () check_macro (MPI_HAS_Fortran_MOD NAME TryMPIMod.f90 HINTS ${CMAKE_MODULE_PATH} DEFINITIONS -I${MPIMOD_PATH} COMMENT "whether MPI Fortran module is supported") if (${MPI_HAS_Fortran_MOD}) message (STATUS "MPI Fortran module verified and enabled.") else () message (STATUS "MPI Fortran module failed verification and therefore disabled.") endif () #===== GPTL ===== if (PIO_ENABLE_TIMING) find_package (GPTL COMPONENTS C Fortran_Perf QUIET) if (GPTL_C_FOUND) message (STATUS "Found GPTL C: ${GPTL_C_LIBRARIES}") else () message (STATUS "Using internal GPTL C library for timing") endif () if (GPTL_Fortran_Perf_FOUND) message (STATUS "Found GPTL Fortran Perf: ${GPTL_Fortran_Perf_LIBRARIES}") else () message (STATUS "Using internal GPTL Fortran library for timing") endif () endif () #============================================================================== # BUILD EXECUTABLES #============================================================================== add_spio_executable(testpio FALSE "" ${SRC}) add_spio_executable(wstest TRUE "" ${WSSRC})