diff --git a/meson.build b/meson.build index 696e973f463963509d055566a33b0ce3ab710f19..2ea063465cf6656fd1c3747256d2c8687b39d279 100644 --- a/meson.build +++ b/meson.build @@ -841,6 +841,7 @@ endif # (even in Linux) which means the linking fails. # binary_c_subdir_objects = [] +binary_c_subdir_deps = [] src_subdirs = run_command('meson/source_directories.sh').stdout().strip().split('\n') src_root_sourcefiles = run_command('meson/source_files.sh','./src').stdout().strip().split('\n') @@ -872,12 +873,11 @@ foreach src_subdir : src_subdirs endif #message('headers : ' + ' '.join(_sources)) - # make the build target and append to binary_c_subdir_objects - binary_c_subdir_objects += build_target( + # add the library containing the compiled _sources + # to the dependency list + _lib = static_library( _target_name, - build_by_default: false, - pic : true, - target_type : 'static_library', + pic: true, sources : [ precompiled_headers, _sources, @@ -888,11 +888,16 @@ foreach src_subdir : src_subdirs cflags, quoted_cflags_list, ], - link_language: 'c', - ) + ) + binary_c_subdir_deps += declare_dependency( + link_with: _lib + ) endif endforeach +# add the subdir libraries to the main dependency list +dependencies += binary_c_subdir_deps + ############################################################ # # binary_c objects references all the binary_c_subdir_objects, @@ -923,11 +928,11 @@ binary_c_objects = build_target( libs, ], link_with : [ - binary_c_subdir_objects, ], link_language: 'c', ) + ############################################################ # # make shared library