Better integration with meson-build
For a better integration with meson-build it would be nice to make the following changes in meson.build
. I can submit a MR if needed.
diff --git a/meson.build b/meson.build
index 28fdc08..fd26eb9 100644
--- a/meson.build
+++ b/meson.build
@@ -31,16 +31,23 @@ libcmocka = library('cmocka',
'src/cmocka.c',
c_args: ['-DHAVE_CONFIG_H'],
include_directories: cmocka_includes,
- install: true,
+ install: meson.is_subproject(),
+ override_options : ['c_std=gnu99'],
dependencies: [cc.find_library('rt', required: false)])
-install_headers('include/cmocka.h')
-
-pkgconfig = import('pkgconfig')
-pkgconfig.generate(libraries : [libcmocka],
- version : '1.1.5',
- name : 'cmocka',
- filebase : 'cmocka',
- description : 'The cmocka unit testing library')
+
+if meson.is_subproject()
+ cmocka_dep = declare_dependency(include_directories : cmocka_includes,
+ link_with : libcmocka)
+else
+ install_headers('include/cmocka.h')
+
+ pkgconfig = import('pkgconfig')
+ pkgconfig.generate(libraries : [libcmocka],
+ version : meson.project_version(),
+ name : 'cmocka',
+ filebase : 'cmocka',
+ description : 'The cmocka unit testing library')
+endif
if get_option('unit_testing')
subdir('tests')
- Add this line in the top
meson.build
:
cmocka_dep = dependency('cmocka', fallback: ['cmocka', 'cmocka_dep'])
Edited by Emmanuel Fleury