Replies: 3 comments 4 replies
-
If they are separate projects e.g. git submodules why can't they be moved to the directory meson uses for subprojects? The entire point of subprojects is that they are isolated and standalone, and merely export a public interface (cmake interface targets, meson Maybe https://mesonbuild.com/Wrap-dependency-system-manual.html would help? |
Beta Was this translation helpful? Give feedback.
-
Based on your description it is a bit unclear how your project is set up. However you should note that variables keep existing when you go into subdirectories and back. So at the top level you can do: my_lib = static_library(..) and then in the tests dir do: executable(..., link_with: my_lib) |
Beta Was this translation helpful? Give feedback.
-
Unless there is another trick which I do not know, in order for the top I tried to find a way to tell However, doing this, prevents it for directly accessing the top folders, like It looks more and more like Mission Impossible :-( |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I am working on a C++ modular project (cross-platform embedded), with various libraries packed as separate projects.
Some of the libraries can be compiled as static libraries, some are headers only, some have sources, but for various reasons must be compiled in the top application context (what CMake calls INTERFACE libraries).
For the static libraries I was able to write a
meson.build
in the project root folder to create the static libraries, and including them on the application withsubdir()
was fine.However, each such library project has a
tests
folder, with various unit tests. Building the tests requires other such libraries as dependencies, available multiple folders.I was not able to identify a
meson.build
configuration that works both for building the unit tests, and also for being included in a top application.To build the tests, the top
meson.build
must have aproject()
as the first call of a project, but when I try to use the library withsubdir()
in an application, meson complains of a secondproject()
encountered.I thought of using the
tests
folder as the root of the tests, but in this case I could not find a way to include the current library code, since it is defined in the parent folder, andsubdir()
can include only children folders.I also thought of using
subproject()
, assuming all dependencies are meson projects. Unfortunately this requires for all sub-projects to be in a single folder, requirement which cannot be met in my environment, since my dependencies are in two folders, and none of them has the hard-coded namesubprojects
.What am I missing? Am I trying to use meson in an impossible configuration?
Beta Was this translation helpful? Give feedback.
All reactions