From 55e3a5ece5d90ea29dcb8ab2d0bb6898a71e8971 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Mon, 6 Jan 2025 15:36:45 -0800 Subject: templates: plumb dependencies into the new project template The command line value exists, and we'll want it soon. --- mesonbuild/templates/cpptemplates.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'mesonbuild/templates/cpptemplates.py') diff --git a/mesonbuild/templates/cpptemplates.py b/mesonbuild/templates/cpptemplates.py index 2d7955ed7..2e16f8d0d 100644 --- a/mesonbuild/templates/cpptemplates.py +++ b/mesonbuild/templates/cpptemplates.py @@ -29,10 +29,14 @@ hello_cpp_meson_template = '''project( default_options : ['warning_level=3', 'cpp_std=c++14'], ) +dependencies = [{dependencies} +] + exe = executable( '{exe_name}', '{source_name}', install : true, + dependencies : dependencies, ) test('basic', exe) @@ -107,6 +111,9 @@ lib_cpp_meson_template = '''project( default_options : ['warning_level=3', 'cpp_std=c++14'], ) +dependencies = [{dependencies} +] + # These arguments are only used to build the shared library # not the executables that use the library. lib_args = ['-DBUILDING_{utoken}'] @@ -117,11 +124,13 @@ shlib = shared_library( install : true, cpp_args : lib_args, gnu_symbol_visibility : 'hidden', + dependencies : dependencies, ) test_exe = executable( '{test_exe_name}', '{test_source_file}', + dependencies : dependencies, link_with : shlib, ) test('{test_name}', test_exe) @@ -129,6 +138,7 @@ test('{test_name}', test_exe) # Make this library usable as a Meson subproject. {ltoken}_dep = declare_dependency( include_directories : include_directories('.'), + dependencies : dependencies, link_with : shlib, ) -- cgit v1.2.3