summaryrefslogtreecommitdiff
path: root/mesonbuild/templates/cpptemplates.py
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2025-11-22 19:06:22 +0000
committerJussi Pakkanen <jussi.pakkanen@mailbox.org>2025-11-23 17:01:13 +0200
commit9104bb616766bd9a05f0b2f280359463d32e227d (patch)
treeb575d6f9cf74c13848e026a9d42267c973543ed7 /mesonbuild/templates/cpptemplates.py
parent06242bc6f47b25c19f91c76897ada39cd425015f (diff)
downloadmeson-9104bb616766bd9a05f0b2f280359463d32e227d.tar.gz
templates: respect parameters
Respect collected sources for `meson init` as well as --executable. This regressed in 9f0ac314ba0c54cc18c2499845324efc14c1849e (part of https://github.com/mesonbuild/meson/pull/14086, it's easier to see how with the whole PR). Also, add subtests (distinguishing between empty directories and those with some file(s) within). We already had some of these but they weren't marked as such. Test `meson init` with a broken source file in the source directory as we should fail with that, not ignore the file. It's easier to test with a broken file than a working one as we can assert the build should fail, it'll pass with just the 1 example file we generate. Closes: https://github.com/mesonbuild/meson/issues/15286
Diffstat (limited to 'mesonbuild/templates/cpptemplates.py')
-rw-r--r--mesonbuild/templates/cpptemplates.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/mesonbuild/templates/cpptemplates.py b/mesonbuild/templates/cpptemplates.py
index cdfbbf8c0..1c742cfaa 100644
--- a/mesonbuild/templates/cpptemplates.py
+++ b/mesonbuild/templates/cpptemplates.py
@@ -35,9 +35,12 @@ hello_cpp_meson_template = '''project(
dependencies = [{dependencies}
]
+sources = [{source_files}
+]
+
exe = executable(
'{exe_name}',
- '{source_name}',
+ [sources],
install : true,
dependencies : dependencies,
)
@@ -121,9 +124,13 @@ dependencies = [{dependencies}
# not the executables that use the library.
lib_args = ['-DBUILDING_{utoken}']
+sources = [{source_files}
+
+]
+
lib = library(
'{lib_name}',
- '{source_file}',
+ [sources],
install : true,
cpp_shared_args : lib_args,
gnu_symbol_visibility : 'hidden',