YCM-Generator
YCM-Generator copied to clipboard
meson/ninja generator creates incorrect include paths
when generating with a trivial meson build file:
project('OctreeOOConverter', 'cpp',
default_options : ['c_std=c17', 'cpp_std=c++17'])
inc = include_directories('inc')
src = ['src/main.cpp']
exe = executable('OctreeOOConverter', src, include_directories : inc)
the following flags are generated:
flags = [
'-x',
'c++',
'-D_FILE_OFFSET_BITS=64',
'-I.',
'-I../../home/philm/Development/rayTracing/OctreeOOConverter',
'-I../../home/philm/Development/rayTracing/OctreeOOConverter/inc',
'-IOctreeOOConverter@exe',
'-Wall',
'-Winvalid-pch',
'-Wnon-virtual-dtor',
'-std=c++17',
]
as one can see, the file paths are incorrect and are not working with YCM they should be the following:
flags = [
...
'-I/home/philm/Development/rayTracing/OctreeOOConverter',
'-I/home/philm/Development/rayTracing/OctreeOOConverter/inc',
...
]
This happens because the project is compiled out-of-tree in a temporary directory. Meson appears to generate relative paths to the files, unlike Cmake which uses absolute paths.
Short of configuring Meson to use absolute paths, there's no easy fix for this, besides manually fixing up the generated flags.