Closed dcbaker closed 5 years ago
CMake also has a method for getting arbitrary variables, however, they might not be 100% accurate.
The main question I have with your proposal is what happens when you forget to specify a method in dep.get_variable
.
For instance, what happens when you call dep.get_variable(cmake : 'vcm', pkg-config : 'vpkg')
but dep
is internally a config-tool dependency?
then you'd get an error, the same as calling one of the specific methods on the wrong dependency type.
Should it also have a default
or something similar for a variable name to try if the dependency type is not one of the listed ones?
That might be a good idea it could have behavior such that if default
is provided it returns that, otherwise error.
We now have 4 different kinds of dependencies, cmake, pkg-config, config-tool, and declare_dependency. pkg-config and config-tool have a method that allow getting arbitrary variables, cmake might but I haven't looked closely. Some dependencies can be found multiple ways (cmake or config-tool for example). Because of that it would be nice to have a generic getter method, such as
Which would be implemented such that each kind of dependency would respect the proper keyword.
@jpakkane, opinions?