diff --git a/gitlab/functions.sh b/gitlab/functions.sh index 6a9b28f94e0ccc1b73c6fb8f014e2a936b59c9e1..cbfea14058d14af95b9d19e6d176b60b8643f30e 100644 --- a/gitlab/functions.sh +++ b/gitlab/functions.sh @@ -203,6 +203,18 @@ prepare_build_env() { } +# Appends a value to a variable if that is not already set +# $1: variable name to append the value +# $2: the value to be appended +append_if_not_set() { + if [ -z "${1+abc}" ]; then + eval $1="$2" + elif [[ "${!1}" != "*${2}*" ]]; then + eval $1="${!1} $2" + fi +} + + # Checks if an array contains a value # taken from here: https://stackoverflow.com/questions/3685970/check-if-an-array-contains-a-value # Parameters: <value-to-check> <array-variable> @@ -300,12 +312,12 @@ else fi if [ "${OSNAME}" == "macosx" ]; then + CC=gcc + export_env CC + CXX=g++ + export_env CXX MACOSX_DEPLOYMENT_TARGET="10.7" export_env MACOSX_DEPLOYMENT_TARGET - if [ -n "${CPPFLAGS}" ]; then - CPPFLAGS="${CPPFLAGS} -DBOOST_NO_CXX11_RVALUE_REFERENCES" - else - CPPFLAGS="-DBOOST_NO_CXX11_RVALUE_REFERENCES" - fi + append_if_not_set CPPFLAGS "-DBOOST_NO_CXX11_RVALUE_REFERENCES" export_env CPPFLAGS fi