/[lmdze]/trunk/FindNetCDF.cmake
ViewVC logotype

Annotation of /trunk/FindNetCDF.cmake

Parent Directory Parent Directory | Revision Log Revision Log


Revision 352 - (hide annotations)
Thu Jan 16 19:20:50 2020 UTC (4 years, 4 months ago) by guez
File size: 1664 byte(s)
Introduce XIOS in program gcm

Introduce XIOS in program gcm. Minimum (and useless) calls: initialize
and finalize.

Take advantage in CMakeLists of improved packaging of libraries:
NetCDF95 brings dependency on NetCDF-Fortran and NetCDF. Compile gcm
with MPI for XIOS.

1 guez 352 find_path(NetCDF_INCLUDE_DIR
2     NAMES netcdf.h
3     DOC "netcdf include directories")
4     ##mark_as_advanced(NetCDF_INCLUDE_DIR)
5    
6     find_library(NetCDF_LIBRARY
7     NAMES netcdf
8     DOC "netcdf library")
9     ##mark_as_advanced(NetCDF_LIBRARY)
10    
11     if (NetCDF_INCLUDE_DIR)
12     file(STRINGS "${NetCDF_INCLUDE_DIR}/netcdf_meta.h" _netcdf_version_lines
13     REGEX "#define[ \t]+NC_VERSION_(MAJOR|MINOR|PATCH|NOTE)")
14     string(REGEX REPLACE ".*NC_VERSION_MAJOR *\([0-9]*\).*" "\\1" _netcdf_version_major "${_netcdf_version_lines}")
15     string(REGEX REPLACE ".*NC_VERSION_MINOR *\([0-9]*\).*" "\\1" _netcdf_version_minor "${_netcdf_version_lines}")
16     string(REGEX REPLACE ".*NC_VERSION_PATCH *\([0-9]*\).*" "\\1" _netcdf_version_patch "${_netcdf_version_lines}")
17     string(REGEX REPLACE ".*NC_VERSION_NOTE *\"\([^\"]*\)\".*" "\\1" _netcdf_version_note "${_netcdf_version_lines}")
18     set(NetCDF_VERSION "${_netcdf_version_major}.${_netcdf_version_minor}.${_netcdf_version_patch}${_netcdf_version_note}")
19     unset(_netcdf_version_major)
20     unset(_netcdf_version_minor)
21     unset(_netcdf_version_patch)
22     unset(_netcdf_version_note)
23     unset(_netcdf_version_lines)
24     endif ()
25    
26     include(FindPackageHandleStandardArgs)
27     find_package_handle_standard_args(NetCDF
28     REQUIRED_VARS NetCDF_LIBRARY NetCDF_INCLUDE_DIR
29     VERSION_VAR NetCDF_VERSION)
30    
31     if (NetCDF_FOUND)
32     set(NetCDF_INCLUDE_DIRS "${NetCDF_INCLUDE_DIR}")
33     set(NetCDF_LIBRARIES "${NetCDF_LIBRARY}")
34    
35     if (NOT TARGET NetCDF::NetCDF)
36     add_library(NetCDF::NetCDF UNKNOWN IMPORTED)
37     set_target_properties(NetCDF::NetCDF PROPERTIES
38     IMPORTED_LOCATION "${NetCDF_LIBRARY}"
39     INTERFACE_INCLUDE_DIRECTORIES "${NetCDF_INCLUDE_DIR}")
40     endif ()
41     endif ()

  ViewVC Help
Powered by ViewVC 1.1.21