dependency.get_option('foo')
doesn't work
#11335
-
I'm wanting to grab an option/variable from a subproject fallback, but This is how I attempt to access the option in my main project:
This is how the dependency is declared in the subproject:
Note, I believe I know what the problem is.
Is my understanding correct? Is there a way to grab the My thought is that if I can see the value of the subproject option via |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Would need to be more specific about your exact use-case, usually the recommended way is to have in the subproject: vars = ['foo=' + get_option('foo')]
bar_dep = declare_dependency(link_with: bar_lib, variables: vars)
pkg.generate(bar_lib, variables: vars) And in the parent project: bar_dep = dependency('bar', fallback...)
foo = bar_dep.get_variable('foo') That way it works regardless whether bar is from subproject or pkgconfig. |
Beta Was this translation helpful? Give feedback.
-
No.
The reason it doesn't work would, presumably, be because you got an error message stating that dependency objects don't have any such method, right? ;)
Kind of sort of maybe. Subprojects have an Dependencies have an
|
Beta Was this translation helpful? Give feedback.
No.
obj.get_option()
isn't a method of anywhere. It's a functionget_option()
.The reason it doesn't work would, presumably, be because you got an error message stating that dependency objects don't have any such method, right? ;)