I am coming from CMake to meson.
I like to work in isolated environments using conda. This way I can control which packages are installed for each project.
Now, In cmake I would pass -DCMAKE_FIND_ROOT_PATH=$CONDA_PREFIX in order to root the search process on a different directory (In my case - the conda env)
So my question is how do I do achieve the same effect on meson?
This is my small meson.build for reference:
project('foo', 'cpp')
cpp = meson.get_compiler('cpp')
spdlog = cpp.find_library('spdlog')
executable('foo',
'src/fact.cpp',
dependencies : [spdlog])
meson is smart enough to find packages inside conda env, assuming that you have pkg-config or cmake installed in said env.
Also - the correct way to add external dependency is using dependency('spdlog') and not find_library.
So the fixed meson.build should look like:
project('foo', 'cpp')
spdlog = dependency('spdlog')
executable('foo',
'src/fact.cpp',
dependencies : [spdlog])
meson receives the parameter
--pkg-config-path path
which will add path to the pkg-config search path.
Adding
spdlog = dependency('spdlog')
Will find spdlog as long as the .pc file is in path
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With