Merge pull request #3069 from dcbaker/pch_one_arg

Fix targets with C and C++ code that use pre compiled headers
pull/3075/head
Jussi Pakkanen 7 years ago committed by GitHub
commit d2445a15a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      mesonbuild/backend/backends.py
  2. 19
      test cases/common/15 mixed pch/meson.build

@ -410,16 +410,10 @@ class Backend:
args = []
pchpath = self.get_target_private_dir(target)
includeargs = compiler.get_include_args(pchpath, False)
for lang in ['c', 'cpp']:
p = target.get_pch(lang)
if not p:
continue
if compiler.can_compile(p[-1]):
header = p[0]
args += compiler.get_pch_use_args(pchpath, header)
if len(args) > 0:
args = includeargs + args
return args
p = target.get_pch(compiler.get_language())
if p:
args += compiler.get_pch_use_args(pchpath, p[0])
return includeargs + args
@staticmethod
def escape_extra_args(compiler, args):

@ -1,6 +1,19 @@
project('mixed C and C++ pch test', 'cpp', 'c')
exe = executable('prog', 'main.cc', 'func.c',
c_pch : ['pch/func.h', 'pch/func_pch.c'],
cpp_pch : ['pch/main_pch.cc', 'pch/main.h'])
exe = executable(
'prog',
files('main.cc', 'func.c'),
c_pch : ['pch/func.h', 'pch/func_pch.c'],
cpp_pch : ['pch/main_pch.cc', 'pch/main.h'],
)
cc = meson.get_compiler('c')
if cc.get_id() != 'msvc'
exe2 = executable(
'prog2',
files('main.cc', 'func.c'),
c_pch : 'pch/func.h',
cpp_pch : 'pch/main.h',
)
endif

Loading…
Cancel
Save