From d0d22f4dede8707f6fcf3414ca6a9b391d784742 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Fri, 31 Mar 2023 01:22:17 +0200 Subject: backend/vs: ensure that build dir is preferred to src dir Previously, the VS backend would add the the include directories in the reverse order that the Ninja backend does it, which means that the source directories would be preferred over the build directories. For example, this would cause the compiler to choose the file from the source directory if a file with the same name is found in both. Fixes 57ec097b5 ("vs: Use CompilerArgs() for compile and link args") Fixes #11630 --- mesonbuild/backend/vs2010backend.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mesonbuild/backend/vs2010backend.py b/mesonbuild/backend/vs2010backend.py index 5718004..47e19a4 100644 --- a/mesonbuild/backend/vs2010backend.py +++ b/mesonbuild/backend/vs2010backend.py @@ -1070,8 +1070,9 @@ class Vs2010Backend(backends.Backend): for i in reversed(d.get_incdirs()): curdir = os.path.join(d.get_curdir(), i) try: - args.append('-I' + self.relpath(curdir, target.subdir)) # build dir + # Add source subdir first so that the build subdir overrides it args.append('-I' + os.path.join(proj_to_src_root, curdir)) # src dir + args.append('-I' + self.relpath(curdir, target.subdir)) # build dir except ValueError: # Include is on different drive args.append('-I' + os.path.normpath(curdir)) -- cgit v1.1