diff options
author | Qyriad <qyriad@qyriad.me> | 2024-04-17 23:37:07 -0600 |
---|---|---|
committer | Qyriad <qyriad@qyriad.me> | 2024-04-18 10:45:27 -0600 |
commit | f9d08cc44c615606186d65fe2e500d10488bf8e4 (patch) | |
tree | cbfc62e96c2562a1064327dcff6daf110bba3013 | |
parent | 077f45ee389643b04a6f0ee15ace8cda775a734a (diff) |
meson: embed source paths as relative to the source root and avoid ../src
Change-Id: Ifab83cb7a3bfde717a4d6032ede8be75dc61f2b1
-rw-r--r-- | meson.build | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/meson.build b/meson.build index f62e93d0c..0c0bfb8f0 100644 --- a/meson.build +++ b/meson.build @@ -413,6 +413,21 @@ if get_option('profile-build').require(meson.get_compiler('cpp').get_id() == 'cl add_project_arguments('-ftime-trace', language: 'cpp') endif +if cxx.get_id() in ['clang', 'gcc'] + add_project_arguments([ + # Meson uses out of source builds, conventionally usually in a subdirectory + # of the source tree (e.g. meson setup ./build). This means that unlike in + # the previous Make buildsystem, all compilation sources are passed as a relative + # parent, e.g. `cc -o src/libexpr/nixexpr.cc.o ../src/libexpr/nixexpr.cc`. + # These paths show up when debugging, and in asserts, which look both look strange + # and confuse debuggers. + # So let's just tell GCC and Clang that ../src really means src. + '-ffile-prefix-map=../src=src', + ], + language : 'cpp', + ) +endif + subdir('src') subdir('scripts') subdir('misc') |