From 7f1d78f30479170baa749e179c70e85a62250b0f Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Mon, 17 Feb 2020 00:42:08 +0530 Subject: tests: Ensure that executable and library are named differently On Windows, the basename is used to determine the name of the PDB file. So for a project called myproject, we will create myproject.dll and myproject.exe, both of which will have myproject.pdb. This is a file collision. Instead, append `_test`, similar to the C# template. Fixes AllPlatformTest.test_templates on MSVC. This became a hard error when we started listing PDBs in the implicit outputs list of ninja targets. Do the same for a test that was making the same mistake. --- mesonbuild/templates/cpptemplates.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'mesonbuild/templates/cpptemplates.py') diff --git a/mesonbuild/templates/cpptemplates.py b/mesonbuild/templates/cpptemplates.py index 5bff67b..f664e42 100644 --- a/mesonbuild/templates/cpptemplates.py +++ b/mesonbuild/templates/cpptemplates.py @@ -153,6 +153,7 @@ def create_lib_cpp_sample(project_name, version): lowercase_token = re.sub(r'[^a-z0-9]', '_', project_name.lower()) uppercase_token = lowercase_token.upper() class_name = uppercase_token[0] + lowercase_token[1:] + test_exe_name = lowercase_token + '_test' namespace = lowercase_token lib_hpp_name = lowercase_token + '.hpp' lib_cpp_name = lowercase_token + '.cpp' @@ -165,7 +166,7 @@ def create_lib_cpp_sample(project_name, version): 'header_file': lib_hpp_name, 'source_file': lib_cpp_name, 'test_source_file': test_cpp_name, - 'test_exe_name': lowercase_token, + 'test_exe_name': test_exe_name, 'project_name': project_name, 'lib_name': lowercase_token, 'test_name': lowercase_token, -- cgit v1.1