forked from NOAA-EMC/NCEPLIBS-external
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
340 lines (305 loc) · 14.4 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
cmake_minimum_required(VERSION 3.12)
enable_language(Fortran)
project(NCEPLIBS-external)
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set (CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "default install path" FORCE )
endif()
# CMP0074: find_package uses PackageName_ROOT variables
if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif(POLICY CMP0074)
# Tell cmake what to build
option(BUILD_MPI "Build MPI?" ON)
option(BUILD_ESMF "Build ESMF?" ON)
option(BUILD_NETCDF "Build NetCDF?" ON)
option(BUILD_JASPER "Build Jasper?" ON)
option(BUILD_PNG "Build libpng?" ON)
option(BUILD_WGRIB2 "Build wgrib2?" ON)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
# Consistency check. To avoid linking errors with different versions of libz,
# either both NetCDF and PNG must be built or none of them.
if((BUILD_NETCDF OR BUILD_PNG) AND NOT (BUILD_NETCDF AND BUILD_PNG))
message(FATAL_ERROR "NetCDF and PNG must both be built or both supplied externally")
endif()
set(libs "MPI" "NETCDF" "ESMF" "JASPER" "PNG" "WGRIB2")
set(libs_to_build)
foreach(lib ${libs})
if(BUILD_${lib})
list(APPEND libs_to_build "${lib} ")
endif()
endforeach()
message(STATUS "Building libraries: " ${libs_to_build})
set(install_path ${CMAKE_INSTALL_PREFIX})
include(ExternalProject)
include(GNUInstallDirs)
if(NOT EXISTS ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR})
file(MAKE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR})
endif()
set(CMAKE_CONFIG_FILE "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/nceplibs-external.cmake.config")
file(WRITE ${CMAKE_CONFIG_FILE} "# CMake configuration file for NCEPLIBS-external\n")
if(BUILD_MPI)
if(${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU" AND ${CMAKE_Fortran_COMPILER_VERSION} VERSION_GREATER 9.9)
set(MPICH_FORTRAN_FLAGS "-w -fallow-argument-mismatch")
message(STATUS "Set Fortran flags for compiling MPICH with gfortran-10+: '${MPICH_FORTRAN_FLAGS}'")
else()
set(MPICH_FORTRAN_FLAGS "")
endif()
set (MPICH_VERSION "3.3.2")
ExternalProject_Add(mpi
PREFIX ${PROJECT_BINARY_DIR}/mpich
SOURCE_DIR ${PROJECT_SOURCE_DIR}/mpich
INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
BUILD_IN_SOURCE 1
DOWNLOAD_COMMAND cd ${PROJECT_BINARY_DIR}/mpich && tar -xzf ${PROJECT_SOURCE_DIR}/mpich/mpich-${MPICH_VERSION}.tar.gz
CONFIGURE_COMMAND cd ${PROJECT_BINARY_DIR}/mpich/mpich-${MPICH_VERSION} && ./configure --prefix=${CMAKE_INSTALL_PREFIX} "FFLAGS=${MPICH_FORTRAN_FLAGS}"
BUILD_COMMAND cd ${PROJECT_BINARY_DIR}/mpich/mpich-${MPICH_VERSION} && $(MAKE) && $(MAKE) check
INSTALL_COMMAND cd ${PROJECT_BINARY_DIR}/mpich/mpich-${MPICH_VERSION} && $(MAKE) install
)
set(MPI_ROOT ${CMAKE_INSTALL_PREFIX})
set(MPI_C_LIBRARY_VERSION_STRING "MPICH")
set(MPI_C_VERSION_MAJOR "3")
file(APPEND ${CMAKE_CONFIG_FILE} "set(MPI_ROOT \"${CMAKE_INSTALL_PREFIX}\")\n")
else()
set(MPI_DETERMINE_LIBRARY_VERSION true)
find_package(MPI REQUIRED)
endif()
if(NOT DEFINED MPITYPE AND BUILD_ESMF)
if(MPI_C_LIBRARY_VERSION_STRING MATCHES ".*CRAY MPICH.*" AND MPI_C_VERSION_MAJOR MATCHES "3")
set(MPITYPE "mpi")
elseif(MPI_C_LIBRARY_VERSION_STRING MATCHES ".*MPICH.*" AND MPI_C_VERSION_MAJOR MATCHES "3")
set(MPITYPE "mpich3")
elseif(MPI_C_LIBRARY_VERSION_STRING MATCHES ".*Open MPI.*" AND MPI_C_VERSION_MAJOR MATCHES "3")
set(MPITYPE "openmpi")
elseif(MPI_C_LIBRARY_VERSION_STRING MATCHES ".*HPE MPT.*" AND MPI_C_VERSION_MAJOR MATCHES "3")
set(MPITYPE "mpt")
elseif(MPI_C_LIBRARY_VERSION_STRING MATCHES ".*Intel.*" AND MPI_C_VERSION_MAJOR MATCHES "3")
set(MPITYPE "intelmpi")
else()
message(FATAL_ERROR "Cannot detect MPI type for ESMF, check that it is supported and set it via -DMPITYPE=... ; calid options are: intelmpi, openmpi, mpich3, mpt, openmpi")
endif()
message(STATUS "Set ESMF MPITYPE to ${MPITYPE}")
endif()
if(BUILD_NETCDF OR BUILD_PNG)
ExternalProject_Add(zlib
PREFIX ${PROJECT_BINARY_DIR}/zlib
SOURCE_DIR ${PROJECT_SOURCE_DIR}/zlib
BINARY_DIR ${PROJECT_BINARY_DIR}/zlib/build
INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
CONFIGURE_COMMAND ${PROJECT_SOURCE_DIR}/zlib/configure --static --prefix=${CMAKE_INSTALL_PREFIX} --libdir=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}
BUILD_COMMAND make
TEST_BEFORE_INSTALL TRUE
TEST_COMMAND cd ${PROJECT_BINARY_DIR}/zlib/build && make test
INSTALL_COMMAND $(MAKE) install
)
file(APPEND ${CMAKE_CONFIG_FILE} "set(ZLIB_ROOT \"${CMAKE_INSTALL_PREFIX}\")\n")
endif()
if(BUILD_NETCDF)
# This is where the libraries will be
set(NETCDF_INCLUDE_DIRS ${CMAKE_INSTALL_PREFIX}/include)
set(HDF5_C_LIBRARY ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}hdf5${CMAKE_STATIC_LIBRARY_SUFFIX})
set(HDF5_HL_LIBRARY ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}hdf5_hl${CMAKE_STATIC_LIBRARY_SUFFIX})
set(ZLIB_LIBRARY ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}z${CMAKE_STATIC_LIBRARY_SUFFIX})
set(NETCDF_C_LIBRARY ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}netcdf${CMAKE_STATIC_LIBRARY_SUFFIX})
set(NETCDF_Fortran_LIBRARY ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}netcdff${CMAKE_STATIC_LIBRARY_SUFFIX})
set(NETCDF_LIBRARIES "${NETCDF_Fortran_LIBRARY} ${NETCDF_C_LIBRARY} ${HDF5_HL_LIBRARY} ${HDF5_C_LIBRARY} ${ZLIB_LIBRARY}")
# Used by configure_file for the configure scripts
set(NCDIR ${CMAKE_INSTALL_PREFIX})
set(H5DIR ${CMAKE_INSTALL_PREFIX})
set(ZDIR ${CMAKE_INSTALL_PREFIX})
ExternalProject_Add(hdf5
PREFIX ${PROJECT_BINARY_DIR}/hdf5
BINARY_DIR ${PROJECT_BINARY_DIR}/hdf5/build
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
-DCMAKE_C_COMPILER=${MPI_C_COMPILER}
-DCMAKE_Fortran_COMPILER=${MPI_Fortran_COMPILER}
-DBUILD_SHARED_LIBS:BOOL=OFF
-DHDF5_BUILD_FORTRAN:BOOL=ON
-DHDF5_ENABLE_PARALLEL=OFF
-DHDF5_BUILD_CPP_LIB=OFF
-DHDF5_BUILD_HL_LIB:BOOL=ON
-DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=ON
-DZLIB_ROOT=${CMAKE_INSTALL_PREFIX}
-DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF
-DCMAKE_BUILD_TYPE=RELEASE
-DHDF5_INSTALL_LIB_DIR=${CMAKE_INSTALL_LIBDIR}
SOURCE_DIR ${PROJECT_SOURCE_DIR}/hdf5
INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
TEST_BEFORE_INSTALL TRUE
TEST_COMMAND cd ${PROJECT_BINARY_DIR}/hdf5/build && make test
DEPENDS zlib
)
# configure NetCDF configure script with installation locations of HDF, install location, etc
configure_file(${PROJECT_SOURCE_DIR}/config_netcdfc.sh.tmpl ${PROJECT_BINARY_DIR}/config_netcdfc.sh)
ExternalProject_Add(netcdf
PREFIX ${PROJECT_BINARY_DIR}/netcdf-c
SOURCE_DIR ${PROJECT_SOURCE_DIR}/netcdf-c
BINARY_DIR ${PROJECT_BINARY_DIR}/netcdf-c
INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E env ${PROJECT_BINARY_DIR}/config_netcdfc.sh
BUILD_COMMAND cd ${PROJECT_BINARY_DIR}/netcdf-c && $(MAKE)
INSTALL_COMMAND cd ${PROJECT_BINARY_DIR}/netcdf-c && $(MAKE) install
TEST_BEFORE_INSTALL TRUE
TEST_COMMAND cd ${PROJECT_BINARY_DIR}/netcdf-c && $(MAKE) check
DEPENDS hdf5
DEPENDS zlib
)
# configure NetCDF configure script with installation locations of NetCDF, HDF, install location, etc
if(${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU" AND ${CMAKE_Fortran_COMPILER_VERSION} VERSION_GREATER 9.9)
set(NETCDF_FORTRAN_FLAGS "-w -fallow-argument-mismatch")
message(STATUS "Set netCDF_Fortran_FLAGS for gfortran-10+: '${NETCDF_FORTRAN_FLAGS}'")
else()
set(NETCDF_FORTRAN_FLAGS "")
endif()
configure_file(${PROJECT_SOURCE_DIR}/config_netcdff.sh.tmpl ${PROJECT_BINARY_DIR}/config_netcdff.sh)
ExternalProject_Add(netcdf-fortran
PREFIX ${PROJECT_BINARY_DIR}/netcdf-fortran
SOURCE_DIR ${PROJECT_SOURCE_DIR}/netcdf-fortran
BINARY_DIR ${PROJECT_BINARY_DIR}/netcdf-fortran
INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E env ${PROJECT_BINARY_DIR}/config_netcdff.sh
BUILD_COMMAND cd ${PROJECT_BINARY_DIR}/netcdf-fortran && $(MAKE)
INSTALL_COMMAND cd ${PROJECT_BINARY_DIR}/netcdf-fortran && $(MAKE) install
TEST_BEFORE_INSTALL TRUE
TEST_COMMAND cd ${PROJECT_BINARY_DIR}/netcdf-fortran && $(MAKE) check
DEPENDS netcdf
)
file(APPEND ${CMAKE_CONFIG_FILE} "set(HDF5_ROOT \"${CMAKE_INSTALL_PREFIX}\")\n")
file(APPEND ${CMAKE_CONFIG_FILE} "set(NETCDF \"${CMAKE_INSTALL_PREFIX}\")\n")
else()
# Find NetCDF
add_custom_target(netcdf-fortran)
find_package(NetCDF COMPONENTS Fortran REQUIRED)
# Reverse list and replace semicolons with spaces as required for ESMF below
list(REVERSE NETCDF_LIBRARIES)
# A rather complicated way to replace ";" with " "
set(NETCDF_LIBRARIES_TMP "")
foreach(itemlib ${NETCDF_LIBRARIES})
set(NETCDF_LIBRARIES_TMP "${NETCDF_LIBRARIES_TMP} ${itemlib}")
endforeach()
string(STRIP "${NETCDF_LIBRARIES_TMP}" NETCDF_LIBRARIES)
endif()
if(BUILD_PNG)
ExternalProject_Add(libpng
PREFIX ${PROJECT_BINARY_DIR}/libpng
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DZLIB_ROOT=${CMAKE_INSTALL_PREFIX}
-DPNG_SHARED=OFF
-DCMAKE_BUILD_TYPE=RELEASE
SOURCE_DIR ${PROJECT_SOURCE_DIR}/libpng
INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
DEPENDS zlib
)
file(APPEND ${CMAKE_CONFIG_FILE} "set(PNG_ROOT \"${CMAKE_INSTALL_PREFIX}\")\n")
else()
# Find PNG
add_custom_target(libpng)
find_package(PNG REQUIRED)
endif()
if(BUILD_JASPER)
# Fix the wrong installation directories in libjpeg's CMakeLists.txt
execute_process(COMMAND patch -N -p0 INPUT_FILE patches/libjpeg.patch WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
ExternalProject_Add(libjpeg
PREFIX ${PROJECT_BINARY_DIR}/libjpeg
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_BUILD_TYPE=RELEASE
SOURCE_DIR ${PROJECT_SOURCE_DIR}/libjpeg
INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
)
configure_file(${PROJECT_SOURCE_DIR}/config_jasper.sh.tmpl ${PROJECT_BINARY_DIR}/config_jasper.sh)
ExternalProject_Add(jasper
PREFIX ${PROJECT_BINARY_DIR}/jasper
SOURCE_DIR ${PROJECT_SOURCE_DIR}/jasper
BINARY_DIR ${PROJECT_BINARY_DIR}/jasper
INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E env ${PROJECT_BINARY_DIR}/config_jasper.sh
BUILD_COMMAND cd ${PROJECT_BINARY_DIR}/jasper && $(MAKE)
INSTALL_COMMAND cd ${PROJECT_BINARY_DIR}/jasper && $(MAKE) install
DEPENDS libjpeg
)
file(APPEND ${CMAKE_CONFIG_FILE} "set(JPEG_ROOT \"${CMAKE_INSTALL_PREFIX}\")\n")
file(APPEND ${CMAKE_CONFIG_FILE} "set(Jasper_ROOT \"${CMAKE_INSTALL_PREFIX}\")\n")
else()
# Find JPEG and Jasper
add_custom_target(libjpeg)
find_package(JPEG)
add_custom_target(jasper)
find_package(Jasper REQUIRED)
endif()
if(BUILD_WGRIB2)
ExternalProject_Add(wgrib2
PREFIX ${PROJECT_BINARY_DIR}/wgrib2
SOURCE_DIR ${PROJECT_SOURCE_DIR}/wgrib2
BINARY_DIR ${PROJECT_BINARY_DIR}/wgrib2
INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
CMAKE_ARGS
-DUSE_NETCDF4=ON
-DUSE_IPOLATES=0
-DUSE_SPECTRAL=OFF
-DMAKE_FTN_API=ON
-DUSE_PNG=ON
-DUSE_JASPER=ON
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_Fortran_COMPILER=${CMAKE_Fortran_COMPILER}
-DCMAKE_PREFIX_PATH=${CMAKE_INSTALL_PREFIX}
DEPENDS jasper libpng netcdf-fortran
)
file(APPEND ${CMAKE_CONFIG_FILE} "set(WGRIB2_ROOT \"${CMAKE_INSTALL_PREFIX}\")\n")
endif()
if(BUILD_ESMF)
if(${CMAKE_C_COMPILER_ID} STREQUAL "Intel")
set(comp "intel")
set(ESMF_BOPT "O")
set(ESMF_OPTLEVEL "2")
set(ESMF_F90COMPILEOPTS "-g -traceback -fp-model precise")
set(ESMF_CXXCOMPILEOPTS "-g -traceback -fp-model precise")
elseif(${CMAKE_C_COMPILER_ID} MATCHES "^(GNU|Clang|AppleClang)$")
set(comp "gfortran")
# Compiling with optimization can lead to crashes on macOS
if(APPLE)
set(ESMF_BOPT "O")
set(ESMF_OPTLEVEL "0")
if (${CMAKE_Fortran_COMPILER_VERSION} VERSION_GREATER 9.9)
set(ESMF_F90COMPILEOPTS "-g -fbacktrace -fallow-argument-mismatch")
else()
set(ESMF_F90COMPILEOPTS "-g -fbacktrace")
endif()
set(ESMF_CXXCOMPILEOPTS "-g -Wno-error=format-security")
else()
set(ESMF_BOPT "O")
set(ESMF_OPTLEVEL "2")
if (${CMAKE_Fortran_COMPILER_VERSION} VERSION_GREATER 9.9)
set(ESMF_F90COMPILEOPTS "-g -fbacktrace -fallow-argument-mismatch")
else()
set(ESMF_F90COMPILEOPTS "-g -fbacktrace")
endif()
set(ESMF_CXXCOMPILEOPTS "-g")
endif()
message(STATUS "Setting ESMF_F90COMPILEOPTS: '${ESMF_F90COMPILEOPTS}'")
endif()
if(NOT BUILD_MPI)
add_custom_target(mpi)
set(ESMF_PATH $ENV{PATH})
else()
set(ESMF_PATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}:$ENV{PATH}")
endif()
# When building only the static ESMF library, cannot run tests on macOS and certain Linux machines (e.g. Travis)
ExternalProject_Add(esmf
PREFIX ${PROJECT_BINARY_DIR}/esmf
SOURCE_DIR ${PROJECT_SOURCE_DIR}/esmf
INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ""
BUILD_COMMAND ${CMAKE_COMMAND} -E env PATH=${ESMF_PATH} ESMF_DIR=${PROJECT_SOURCE_DIR}/esmf ESMF_COMM=${MPITYPE} ESMF_COMPILER=${comp} ESMF_NETCDF=1 ESMF_NETCDF_INCLUDE=${NETCDF_INCLUDE_DIRS} ESMF_NETCDF_LIBS=${NETCDF_LIBRARIES} ESMF_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} ESMF_BOPT=${ESMF_BOPT} ESMF_SHARED_LIB_BUILD=OFF ESMF_OPTLEVEL=${ESMF_OPTLEVEL} ESMF_F90COMPILEOPTS=${ESMF_F90COMPILEOPTS} ESMF_CXXCOMPILEOPTS=${ESMF_CXXCOMPILEOPTS} $(MAKE)
#TEST_COMMAND cd ${PROJECT_SOURCE_DIR}/esmf && make check ESMF_DIR=${PROJECT_SOURCE_DIR}/esmf
#TEST_BEFORE_INSTALL TRUE
INSTALL_COMMAND ${CMAKE_COMMAND} -E env PATH=${ESMF_PATH} ESMF_DIR=${PROJECT_SOURCE_DIR}/esmf ESMF_COMM=${MPITYPE} ESMF_COMPILER=${comp} ESMF_NETCDF=1 ESMF_NETCDF_INCLUDE=${NETCDF_INCLUDE_DIRS} ESMF_NETCDF_LIBS=${NETCDF_LIBRARIES} ESMF_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} ESMF_INSTALL_HEADERDIR=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR} ESMF_INSTALL_MODDIR=${CMAKE_INSTALL_PREFIX}/mod ESMF_INSTALL_LIBDIR=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR} ESMF_INSTALL_BINDIR=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR} ESMF_BOPT=${ESMF_BOPT} ESMF_OPTLEVEL=${ESMF_OPTLEVEL} ESMF_F90COMPILEOPTS=${ESMF_F90COMPILEOPTS} ESMF_CXXCOMPILEOPTS=${ESMF_CXXCOMPILEOPTS} $(MAKE) install
DEPENDS mpi netcdf-fortran)
file(APPEND ${CMAKE_CONFIG_FILE} "set(ESMFMKFILE \"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/esmf.mk\")\n")
endif()