forked from NOAA-EMC/CMEPS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
48 lines (40 loc) · 1.32 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
cmake_minimum_required(VERSION 3.10)
include(ExternalProject)
if (DEFINED CIMEROOT)
message("Using CIME in ${CIMEROOT} with compiler ${COMPILER}")
include(${CASEROOT}/Macros.cmake)
if (${PIO_VERSION} LESS 2)
message( FATAL_ERROR "Version 2 of the PIO library required")
endif()
if (${MPILIB} STREQUAL "mpi-serial")
set(CMAKE_C_COMPILER ${SCC})
set(CMAKE_Fortran_COMPILER ${SFC})
set(CMAKE_CXX_COMPILER ${SCXX})
else()
set(CMAKE_C_COMPILER ${MPICC})
set(CMAKE_Fortran_COMPILER ${MPIFC})
set(CMAKE_CXX_COMPILER ${MPICXX})
endif()
set(CMAKE_Fortran_FLAGS "${FFLAGS} -I${LIBROOT}/include -I${LIBROOT}/finclude -I${LIBROOT}/nuopc/esmf/${NINST_VALUE}/include")
else()
set(BLD_STANDALONE TRUE)
endif()
project(CMEPS LANGUAGES Fortran VERSION 0.1)
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
message("CMAKE_MODULE_PATH is ${CMAKE_MODULE_PATH}")
find_package(ESMF REQUIRED)
if (DEFINED PIO)
set(PIO_PATH ${PIO})
else()
set(PIO_PATH $ENV{PIO})
endif()
find_package(PIO REQUIRED COMPONENT C Fortran PATH ${PIO_PATH})
if (NOT DEFINED MPILIB OR NOT ${MPILIB} STREQUAL "mpi-serial")
find_package(MPI REQUIRED)
endif()
if(BLD_STANDALONE)
add_subdirectory(ufs)
list(APPEND EXTRA_LIBS cmeps_share)
list(APPEND EXTRA_INCLUDES "${CMAKE_BINARY_DIR}/ufs")
endif()
add_subdirectory(mediator)