From 5b44cd0f2ca3ca3ef30c83ab8d004480996dfe62 Mon Sep 17 00:00:00 2001 From: Robert Izzard <r.izzard@surrey.ac.uk> Date: Wed, 27 Nov 2019 09:35:12 +0800 Subject: [PATCH] add checks on include dirs to make sure they exist add script to do the above --- meson.build | 14 ++++++++------ meson/directory_exists.sh | 8 ++++++++ 2 files changed, 16 insertions(+), 6 deletions(-) create mode 100755 meson/directory_exists.sh diff --git a/meson.build b/meson.build index d6b2eb8cf..76ddde723 100644 --- a/meson.build +++ b/meson.build @@ -538,12 +538,14 @@ _include_search_paths = [ '/usr/local/include', ] foreach idir : _include_search_paths - inc_arg = idir - _Inc_arg = '-I' + idir - if not found and compiler.has_header('gsl/gsl_blas.h', - args: _Inc_arg) - my_incdirs += [inc_arg] - found = true + if run_command('sh','-c','meson/directory_exists.sh',idir).returncode() == 0 + inc_arg = idir + _Inc_arg = '-I' + idir + if not found and compiler.has_header('gsl/gsl_blas.h', + args: _Inc_arg) + my_incdirs += [inc_arg] + found = true + endif endif endforeach diff --git a/meson/directory_exists.sh b/meson/directory_exists.sh new file mode 100755 index 000000000..43fe49a4c --- /dev/null +++ b/meson/directory_exists.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +# return 0 if directory exists, 1 otherwise +if [[ -d "$1" ]]; then + exit 0; +else + exit 1; +fi -- GitLab