summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIñigo Martínez <inigomartinez@gmail.com>2018-01-27 09:45:58 +0100
committerIñigo Martínez <inigomartinez@gmail.com>2018-01-29 14:42:46 +0100
commit7a83f0caa6bbac71ceaf2bba8e0565dedfeca037 (patch)
treeb3a5a95dfdc44491b5ad3038b55a0a2627012067
parent9c56c9b3da3964a2bbf8abe6dc061476a8e7ea02 (diff)
downloadlibgnome-volume-control-7a83f0caa6bbac71ceaf2bba8e0565dedfeca037.tar.gz
build: Make use of assert function
meson has support for `assert` function, which halts meson's execution showing a given message when a given condition is false. This patch takes advantage of this function to slightly improve meson's build file readibility. It also removes a duplicated check for `pkglibdir` being set when introspection is also set, because this check is already done when a shared library is being created, that is a precondition for introspection generation. https://bugzilla.gnome.org/show_bug.cgi?id=792948
-rw-r--r--meson.build19
1 files changed, 4 insertions, 15 deletions
diff --git a/meson.build b/meson.build
index a9b223a..0d16eea 100644
--- a/meson.build
+++ b/meson.build
@@ -3,9 +3,7 @@ project('gvc', 'c',
default_options: 'default_library=static'
)
-if not meson.is_subproject()
- error('This project is only intended to be used as a subproject!')
-endif
+assert(meson.is_subproject(), 'This project is only intended to be used as a subproject!')
gnome = import('gnome')
@@ -68,13 +66,7 @@ cdata.set('HAVE_ALSA', enable_alsa)
static = get_option('default_library') == 'static'
enable_introspection = get_option('introspection')
-if not static and pkglibdir == ''
- error('Installing shared library, but pkglibdir is unset!')
-endif
-
-if static and enable_introspection
- error('Currently meson requires a shared library for building girs.')
-endif
+assert(static or pkglibdir != '', 'Installing shared library, but pkglibdir is unset!')
c_args = ['-DG_LOG_DOMAIN="Gvc"']
@@ -93,11 +85,8 @@ libgvc = library('gvc',
)
if enable_introspection
- if pkgdatadir == ''
- error('Installing introspection, but pkgdatadir is unset!')
- elif (pkglibdir == '')
- error('Installing introspection, but pkglibdir is unset!')
- endif
+ assert(not static, 'Currently meson requires a shared library for building girs.')
+ assert(pkgdatadir != '', 'Installing introspection, but pkgdatadir is unset!')
libgvc_gir = gnome.generate_gir(libgvc,
sources: libgvc_gir_sources + libgvc_gir_headers,