compile pch .h file as c++-header when building a c++ target

Fixes #3641.
pull/4699/head
Nicolas Schneider 6 years ago committed by Jussi Pakkanen
parent d25146ffc0
commit 739341ec04
  1. 4
      mesonbuild/backend/ninjabackend.py

@ -2184,6 +2184,10 @@ rule FORTRAN_DEP_HACK%s
def generate_gcc_pch_command(self, target, compiler, pch): def generate_gcc_pch_command(self, target, compiler, pch):
commands = self._generate_single_compile(target, compiler) commands = self._generate_single_compile(target, compiler)
if pch.split('.')[-1] == 'h' and compiler.language == 'cpp':
# Explicitly compile pch headers as C++. If Clang is invoked in C++ mode, it actually warns if
# this option is not set, and for gcc it also makes sense to use it.
commands += ['-x', 'c++-header']
dst = os.path.join(self.get_target_private_dir(target), dst = os.path.join(self.get_target_private_dir(target),
os.path.basename(pch) + '.' + compiler.get_pch_suffix()) os.path.basename(pch) + '.' + compiler.get_pch_suffix())
dep = dst + '.' + compiler.get_depfile_suffix() dep = dst + '.' + compiler.get_depfile_suffix()

Loading…
Cancel
Save