You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a large collection of 3rd party libraries that various parts of my project need to link to. I've been doing this like so:
At the top level of my project I have an absolute path to the collection of libraries: DEPS_REPO = join_paths(meson.current_source_dir(), '../../../3rdPartyRepo)
Having this as an absolute path is nice since:
find_library requires an absolute path for its dirs argument.
The path remains valid even when using it from nested subdirectories in my project.
This works fine for me on Windows with Meson 0.57.1, however with the same version of Meson on Ubuntu 20.04 I get ERROR: Tried to form an absolute path to a source dir. You should not do that but use relative paths instead.
Aside from the issue of getting inconsistent behavior between OS's I don't understand why these restrictions are in place. It would be nice if both include_directories and find_library(..., dir: would allow the usage of both relative and absolute paths.
Is there an entirely different way that I should go about this? I had considered using declare_dependency since it would allow me to bundle the linker path and the include directory into a single dependency object but it seemed like this was going against the intended behavior since these aren't dependencies which will be used in other parts of the project, as soon as they are created they are passed to library(..., dependencies: and never used again.
As final note, I think it would be really useful if the "FS" module had functionality similar to Python's os.path.abspath and os.path.relpath for converting paths as needed.
The text was updated successfully, but these errors were encountered:
As final note, I think it would be really useful if the "FS" module had functionality similar to Python's os.path.abspath and os.path.relpath for converting paths as needed.
Incidentally I don't know why this would fail to report an error on Windows, the build_incdir_object() method does not distinguish between Windows and Linux. What is the current value of meson.current_source_dir()?
I'm no longer working in that project and don't really have an easy way to go back and test it. This was on Meson 0.57 so it's possible that something has changed since then.
I have a large collection of 3rd party libraries that various parts of my project need to link to. I've been doing this like so:
At the top level of my project I have an absolute path to the collection of libraries:
DEPS_REPO = join_paths(meson.current_source_dir(), '../../../3rdPartyRepo)
Having this as an absolute path is nice since:
find_library
requires an absolute path for itsdirs
argument.I then do this:
This works fine for me on Windows with Meson 0.57.1, however with the same version of Meson on Ubuntu 20.04 I get
ERROR: Tried to form an absolute path to a source dir. You should not do that but use relative paths instead.
Aside from the issue of getting inconsistent behavior between OS's I don't understand why these restrictions are in place. It would be nice if both
include_directories
andfind_library(..., dir:
would allow the usage of both relative and absolute paths.Is there an entirely different way that I should go about this? I had considered using
declare_dependency
since it would allow me to bundle the linker path and the include directory into a single dependency object but it seemed like this was going against the intended behavior since these aren't dependencies which will be used in other parts of the project, as soon as they are created they are passed tolibrary(..., dependencies:
and never used again.As final note, I think it would be really useful if the "FS" module had functionality similar to Python's
os.path.abspath
andos.path.relpath
for converting paths as needed.The text was updated successfully, but these errors were encountered: