The Meson Build System http://mesonbuild.com/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.2 KiB

project('netcdf_test', 'c')
cc = meson.get_compiler('c')
c_code = '''#include <netcdf.h>
int main(void) { return 0; }'''
# --- C
nc_c = dependency('netcdf', language : 'c', required : false, disabler: true)
if not cc.links(c_code, dependencies: nc_c, name: 'NetCDF C')
nc_c = disabler()
endif
6 years ago
if not nc_c.found()
error('MESON_SKIP_TEST: NetCDF C library not found, skipping NetCDF framework tests.')
endif
exec = executable('exec', 'main.c', dependencies : nc_c)
test('NetCDF C', exec, timeout: 15)
6 years ago
# --- C++
if add_languages('cpp', required: false)
nc_cpp = dependency('netcdf', language : 'cpp', required : false, disabler: true)
6 years ago
execpp = executable('execpp', 'main.cpp', dependencies : nc_cpp)
test('NetCDF C++', execpp, timeout: 15)
6 years ago
endif
# --- Fortran
if build_machine.system() != 'windows' and build_machine.system() != 'darwin'
if add_languages('fortran', required: false)
nc_f = dependency('netcdf', language : 'fortran', required : false, disabler: true)
6 years ago
exef = executable('exef', 'main.f90', dependencies : nc_f)
test('NetCDF Fortran', exef, timeout: 15)
6 years ago
endif
endif
# Check we can apply a version constraint
if nc_c.version() != 'unknown'
dependency('netcdf', version: '>=@0@'.format(nc_c.version()))
endif