@ -755,8 +755,19 @@ class BuildTarget(Target):
self . process_objectlist ( objects )
self . process_objectlist ( objects )
self . process_kwargs ( kwargs )
self . process_kwargs ( kwargs )
self . missing_languages = self . process_compilers ( )
self . missing_languages = self . process_compilers ( )
self . link ( extract_as_list ( kwargs , ' link_with ' ) )
self . link_whole ( extract_as_list ( kwargs , ' link_whole ' ) )
# self.link_targets and self.link_whole_targets contains libraries from
# dependencies (see add_deps()). They have not been processed yet because
# we have to call process_compilers() first and we need to process libraries
# from link_with and link_whole first.
# See https://github.com/mesonbuild/meson/pull/11957#issuecomment-1629243208.
link_targets = extract_as_list ( kwargs , ' link_with ' ) + self . link_targets
link_whole_targets = extract_as_list ( kwargs , ' link_whole ' ) + self . link_whole_targets
self . link_targets . clear ( )
self . link_whole_targets . clear ( )
self . link ( link_targets )
self . link_whole ( link_whole_targets )
if not any ( [ self . sources , self . generated , self . objects , self . link_whole_targets , self . structured_sources ,
if not any ( [ self . sources , self . generated , self . objects , self . link_whole_targets , self . structured_sources ,
kwargs . pop ( ' _allow_no_sources ' , False ) ] ) :
kwargs . pop ( ' _allow_no_sources ' , False ) ] ) :
mlog . warning ( f ' Build target { name } has no sources. '
mlog . warning ( f ' Build target { name } has no sources. '
@ -1337,8 +1348,8 @@ class BuildTarget(Target):
self . extra_files . extend ( f for f in dep . extra_files if f not in self . extra_files )
self . extra_files . extend ( f for f in dep . extra_files if f not in self . extra_files )
self . add_include_dirs ( dep . include_directories , dep . get_include_type ( ) )
self . add_include_dirs ( dep . include_directories , dep . get_include_type ( ) )
self . objects . extend ( dep . objects )
self . objects . extend ( dep . objects )
self . link ( dep . libraries )
self . link_targets . extend ( dep . libraries )
self . link_whole ( dep . whole_libraries )
self . link_whole_targets . extend ( dep . whole_libraries )
if dep . get_compile_args ( ) or dep . get_link_args ( ) :
if dep . get_compile_args ( ) or dep . get_link_args ( ) :
# Those parts that are external.
# Those parts that are external.
extpart = dependencies . InternalDependency ( ' undefined ' ,
extpart = dependencies . InternalDependency ( ' undefined ' ,