2 Provides the following variables:
4 * `NetCDF_FOUND`: Whether NetCDF was found or not.
5 * `NetCDF_INCLUDE_DIRS`: Include directories necessary to use NetCDF.
6 * `NetCDF_LIBRARIES`: Libraries necessary to use NetCDF.
7 * `NetCDF_VERSION`: The
version of NetCDF found.
8 * `NetCDF::NetCDF`: A
target to use with `target_link_libraries`.
9 * `NetCDF_HAS_PARALLEL`: Whether or not NetCDF was found with parallel IO support.
13 file(STRINGS
"${include_dir}/netcdf_meta.h" _netcdf_lines
14 REGEX
"#define[ \t]+NC_HAS_PARALLEL[ \t]")
15 string(REGEX REPLACE
".*NC_HAS_PARALLEL[ \t]*([0-1]+).*" "\\1" _netcdf_has_parallel
"${_netcdf_lines}")
16 if (_netcdf_has_parallel)
17 set(NetCDF_HAS_PARALLEL TRUE PARENT_SCOPE)
19 set(NetCDF_HAS_PARALLEL FALSE PARENT_SCOPE)
23 # Try to find a CMake-built NetCDF. 24 find_package(netCDF CONFIG QUIET)
26 # Forward the variables in a consistent way. 27 set(NetCDF_FOUND
"${netCDF_FOUND}")
28 set(NetCDF_INCLUDE_DIRS
"${netCDF_INCLUDE_DIR}")
29 set(NetCDF_LIBRARIES
"${netCDF_LIBRARIES}")
30 set(NetCDF_VERSION
"${NetCDFVersion}")
32 include(FindPackageHandleStandardArgs)
33 find_package_handle_standard_args(NetCDF
34 REQUIRED_VARS NetCDF_INCLUDE_DIRS NetCDF_LIBRARIES
35 VERSION_VAR NetCDF_VERSION)
37 if (NOT TARGET NetCDF::NetCDF)
38 add_library(NetCDF::NetCDF INTERFACE IMPORTED)
39 if (TARGET
"netCDF::netcdf")
41 set_target_properties(NetCDF::NetCDF PROPERTIES
42 INTERFACE_LINK_LIBRARIES
"netCDF::netcdf")
43 elseif (TARGET
"netcdf")
44 set_target_properties(NetCDF::NetCDF PROPERTIES
45 INTERFACE_LINK_LIBRARIES
"netcdf")
47 set_target_properties(NetCDF::NetCDF PROPERTIES
48 INTERFACE_LINK_LIBRARIES
"${netCDF_LIBRARIES}")
53 # Skip the rest of the logic in this file. 57 find_package(PkgConfig QUIET) 59 pkg_check_modules(_NetCDF QUIET netcdf IMPORTED_TARGET) 61 # Forward the variables in a consistent way. 62 set(NetCDF_FOUND "${_NetCDF_FOUND}
") 63 set(NetCDF_INCLUDE_DIRS "${_NetCDF_INCLUDE_DIRS}
") 64 set(NetCDF_LIBRARIES "${_NetCDF_LIBRARIES}
") 65 set(NetCDF_VERSION "${_NetCDF_VERSION}
") 67 include(FindPackageHandleStandardArgs) 68 find_package_handle_standard_args(NetCDF 69 REQUIRED_VARS NetCDF_LIBRARIES 70 # This is not required because system-default include paths are not 71 # reported by `FindPkgConfig`, so this might be empty. Assume that if we 72 # have a library, the include directories are fine (if any) since 73 # PkgConfig reported that the package was found. 75 VERSION_VAR NetCDF_VERSION) 77 if (NOT TARGET NetCDF::NetCDF) 78 add_library(NetCDF::NetCDF INTERFACE IMPORTED) 79 set_target_properties(NetCDF::NetCDF PROPERTIES 80 INTERFACE_LINK_LIBRARIES "PkgConfig::_NetCDF
") 83 FindNetCDF_get_is_parallel_aware("${_NetCDF_INCLUDEDIR}
") 84 # Skip the rest of the logic in this file. 89 find_path(NetCDF_INCLUDE_DIR 91 DOC "netcdf include directories
") 92 mark_as_advanced(NetCDF_INCLUDE_DIR) 94 find_library(NetCDF_LIBRARY 97 mark_as_advanced(NetCDF_LIBRARY) 99 if (NetCDF_INCLUDE_DIR) 100 file(STRINGS "${NetCDF_INCLUDE_DIR}/netcdf_meta.h
" _netcdf_version_lines 101 REGEX "#define[ \t]+NC_VERSION_(MAJOR|MINOR|PATCH|NOTE)
") 102 string(REGEX REPLACE ".*NC_VERSION_MAJOR *\([0-9]*\).*
" "\\1
" _netcdf_version_major "${_netcdf_version_lines}
") 103 string(REGEX REPLACE ".*NC_VERSION_MINOR *\([0-9]*\).*
" "\\1
" _netcdf_version_minor "${_netcdf_version_lines}
") 104 string(REGEX REPLACE ".*NC_VERSION_PATCH *\([0-9]*\).*
" "\\1
" _netcdf_version_patch "${_netcdf_version_lines}
") 105 string(REGEX REPLACE ".*NC_VERSION_NOTE *\
"\([^\"]*\)\".*" "\\1" _netcdf_version_note
"${_netcdf_version_lines}")
106 set(NetCDF_VERSION
"${_netcdf_version_major}.${_netcdf_version_minor}.${_netcdf_version_patch}${_netcdf_version_note}")
107 unset(_netcdf_version_major)
108 unset(_netcdf_version_minor)
109 unset(_netcdf_version_patch)
110 unset(_netcdf_version_note)
111 unset(_netcdf_version_lines)
116 include(FindPackageHandleStandardArgs)
117 find_package_handle_standard_args(NetCDF
118 REQUIRED_VARS NetCDF_LIBRARY NetCDF_INCLUDE_DIR
119 VERSION_VAR NetCDF_VERSION)
122 set(NetCDF_INCLUDE_DIRS
"${NetCDF_INCLUDE_DIR}")
123 set(NetCDF_LIBRARIES
"${NetCDF_LIBRARY}")
125 if (NOT TARGET NetCDF::NetCDF)
126 add_library(NetCDF::NetCDF UNKNOWN IMPORTED)
127 set_target_properties(NetCDF::NetCDF PROPERTIES
128 IMPORTED_LOCATION
"${NetCDF_LIBRARY}" 129 INTERFACE_INCLUDE_DIRECTORIES
"${NetCDF_INCLUDE_DIR}")
boost::graph_traits< vtkGraph *>::vertex_descriptor target(boost::graph_traits< vtkGraph *>::edge_descriptor e, vtkGraph *)
function FindNetCDF_get_is_parallel_aware(include_dir)
Provides the following variables: