diff options
author | Nicolas Schneider <nioncode+git@gmail.com> | 2019-01-01 16:13:27 +0100 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2019-01-01 18:57:43 +0200 |
commit | 739341ec045a42892b454f59f76515f73c2a8759 (patch) | |
tree | 72a9c5c9b6d813f6c67c9e18f10ad30a87f48d82 | |
parent | d25146ffc0290c1fcd549e9bb08174d42d576d98 (diff) | |
download | meson-739341ec045a42892b454f59f76515f73c2a8759.zip meson-739341ec045a42892b454f59f76515f73c2a8759.tar.gz meson-739341ec045a42892b454f59f76515f73c2a8759.tar.bz2 |
compile pch .h file as c++-header when building a c++ target
Fixes #3641.
-rw-r--r-- | mesonbuild/backend/ninjabackend.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 5d59fa9..372d7c2 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -2184,6 +2184,10 @@ rule FORTRAN_DEP_HACK%s def generate_gcc_pch_command(self, target, compiler, pch): 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), os.path.basename(pch) + '.' + compiler.get_pch_suffix()) dep = dst + '.' + compiler.get_depfile_suffix() |