Introduction:
The main objective is having the ability to debug c++ code with F5
(Run->start debugging
) in vs code via meson/ninja build system.
This can be done by following stenosis's answer here. Unfortunately, this feature has broken when I added boost library to the project. The program won't compile via F5
, because vs code running meson as a task can't find the boost library:
meson.build:33:0: ERROR: Dependency "boost" not found, tried system
(Note that meson compile
works, because I defined export BOOST_ROOT=/usr/local/boost_1_78_0/
).
Question
I have a feeling that the solution is to add /usr/local/boost_1_78_0/
to search directory (-I
flag) in meson.build
file. How can one specify this?
Notes and tried approaches:
- I added
-I
and/usr/local/boost_1_78_0/
as arguments totasks.json
according to this question (I include only boost headers in my project), but then I get:
> Executing task: 'meson build --buildtype=debug && cd builddir && ninja' -I /usr/local/boost_1_78_0/ <
/usr/bin/bash: meson build --buildtype=debug && cd builddir && ninja: command not found
I typed
meson configure -Dpkg_config_path=/usr/local/boost_1_78_0/
but this didn't work.Meson documentation specifies setting the custom path to the library in native files, but I didn't work it out thoroughly. At a first glance, it looks like overcomplicated approach to a simple problem.
(slightly tangent) Debuging with
F5
in vs code can also be triggered by specifyingbackend_startup_project
in Mesonbuild.file
. This worked for me on former version of Meson (0.58.?), but now (v. 0.60.3) I come across this bug and I must comment out this fragment or I getmeson.build:4:25: ERROR: Expecting rparen got id
.
EDIT:
- I add boost as the dependency in the following way:
boost_dep = dependency('boost')
executable('main', 'main.cpp', sources : sourcelist, dependencies : [..., boost_dep])