Warning, /education/labplot/cmake/FindnetCDF.cmake is written in an unsupported language. File is not indexed.
0001 #============================================================================= 0002 # Copyright (c) 2019 Harald Sitter <sitter@kde.org> 0003 # 0004 # Redistribution and use in source and binary forms, with or without 0005 # modification, are permitted provided that the following conditions 0006 # are met: 0007 # 0008 # 1. Redistributions of source code must retain the copyright 0009 # notice, this list of conditions and the following disclaimer. 0010 # 2. Redistributions in binary form must reproduce the copyright 0011 # notice, this list of conditions and the following disclaimer in the 0012 # documentation and/or other materials provided with the distribution. 0013 # 3. The name of the author may not be used to endorse or promote products 0014 # derived from this software without specific prior written permission. 0015 # 0016 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 0017 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 0018 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 0019 # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 0020 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 0021 # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 0022 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 0023 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 0024 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 0025 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 0026 #============================================================================= 0027 0028 # Try to find via config. If that isn't available fall back to manual lookup. 0029 # Config is vastly preferable because it will also make sure link dependencies 0030 # are found and actually in the target link interface. 0031 if(NOT MSVC_FOUND AND NOT APPLE) 0032 find_package(netCDF ${netCDF_FIND_VERSION} ${netCDF_FIND_REQUIRED} CONFIG QUIET) 0033 if(netCDF_FOUND) 0034 MESSAGE (STATUS "Found netCDF: ${netCDF_INCLUDE_DIR}, ${netCDF_LIBRARIES} (found version \"${netCDF_VERSION}\")") 0035 return() 0036 endif() 0037 endif() 0038 0039 find_package(PkgConfig QUIET) 0040 pkg_check_modules(PC_netCDF netcdf QUIET) 0041 0042 find_library(netCDF_LIBRARIES 0043 NAMES netcdf 0044 HINTS ${PC_netCDF_LIBRARY_DIRS} 0045 ) 0046 0047 find_path(netCDF_INCLUDE_DIR 0048 NAMES netcdf.h 0049 HINTS ${PC_netCDF_INCLUDE_DIRS} 0050 ) 0051 0052 set(netCDF_VERSION ${PC_netCDF_VERSION}) 0053 0054 include(FindPackageHandleStandardArgs) 0055 find_package_handle_standard_args(netCDF 0056 FOUND_VAR 0057 netCDF_FOUND 0058 REQUIRED_VARS 0059 netCDF_LIBRARIES 0060 netCDF_INCLUDE_DIR 0061 VERSION_VAR 0062 netCDF_VERSION 0063 ) 0064 0065 if(netCDF_FOUND AND NOT TARGET netcdf) 0066 add_library(netcdf UNKNOWN IMPORTED) 0067 set_target_properties(netcdf PROPERTIES 0068 IMPORTED_LOCATION "${netCDF_LIBRARIES}" 0069 INTERFACE_INCLUDE_DIRECTORIES "${netCDF_INCLUDE_DIR}" 0070 ) 0071 endif() 0072 0073 mark_as_advanced(netCDF_LIBRARIES netCDF_INCLUDE_DIR netCDF_VERSION) 0074 0075 include(FeatureSummary) 0076