diff options
Diffstat (limited to '')
-rw-r--r-- | test cases/frameworks/26 netcdf/meson.build | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test cases/frameworks/26 netcdf/meson.build b/test cases/frameworks/26 netcdf/meson.build new file mode 100644 index 0000000..0adc5e9 --- /dev/null +++ b/test cases/frameworks/26 netcdf/meson.build @@ -0,0 +1,36 @@ +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 +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) + +# --- C++ +if add_languages('cpp', required: false) + nc_cpp = dependency('netcdf', language : 'cpp', required : false, disabler: true) + execpp = executable('execpp', 'main.cpp', dependencies : nc_cpp) + test('NetCDF C++', execpp, timeout: 15) +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) + exef = executable('exef', 'main.f90', dependencies : nc_f) + test('NetCDF Fortran', exef, timeout: 15) + endif +endif + +# Check we can apply a version constraint +if nc_c.version() != 'unknown' + dependency('netcdf', version: '>=@0@'.format(nc_c.version())) +endif |