Warning, /education/labplot/cmake/FindnetCDF.cmake is written in an unsupported language. File is not indexed.

0001 #=============================================================================
0002 # SPDX-FileCopyrightText: 2019 Harald Sitter <sitter@kde.org>
0003 #
0004 # SPDX-License-Identifier: BSD-3-Clause
0005 #=============================================================================
0006 
0007 # Try to find via config. If that isn't available fall back to manual lookup.
0008 # Config is vastly preferable because it will also make sure link dependencies
0009 # are found and actually in the target link interface.
0010 if(NOT MSVC_FOUND AND NOT APPLE)
0011     find_package(netCDF ${netCDF_FIND_VERSION} ${netCDF_FIND_REQUIRED} CONFIG QUIET)
0012     if(netCDF_FOUND)
0013         MESSAGE (STATUS "Found netCDF: ${netCDF_INCLUDE_DIR}, ${netCDF_LIBRARIES} (found version \"${netCDF_VERSION}\")")
0014         return()
0015     endif()
0016 endif()
0017 
0018 find_package(PkgConfig QUIET)
0019 pkg_check_modules(PC_netCDF netcdf QUIET)
0020 
0021 find_library(netCDF_LIBRARIES
0022     NAMES netcdf
0023     HINTS ${PC_netCDF_LIBRARY_DIRS}
0024 )
0025 
0026 find_path(netCDF_INCLUDE_DIR
0027     NAMES netcdf.h
0028     HINTS ${PC_netCDF_INCLUDE_DIRS}
0029 )
0030 
0031 set(netCDF_VERSION ${PC_netCDF_VERSION})
0032 
0033 include(FindPackageHandleStandardArgs)
0034 find_package_handle_standard_args(netCDF
0035     FOUND_VAR
0036         netCDF_FOUND
0037     REQUIRED_VARS
0038         netCDF_LIBRARIES
0039         netCDF_INCLUDE_DIR
0040     VERSION_VAR
0041         netCDF_VERSION
0042 )
0043 
0044 if(netCDF_FOUND AND NOT TARGET netcdf)
0045     add_library(netcdf UNKNOWN IMPORTED)
0046     set_target_properties(netcdf PROPERTIES
0047         IMPORTED_LOCATION "${netCDF_LIBRARIES}"
0048         INTERFACE_INCLUDE_DIRECTORIES "${netCDF_INCLUDE_DIR}"
0049     )
0050 else()
0051     set(netCDF_LIBRARIES "")
0052 endif()
0053 
0054 mark_as_advanced(netCDF_LIBRARIES netCDF_INCLUDE_DIR netCDF_VERSION)
0055 
0056 include(FeatureSummary)
0057