forked from mesonbuild/meson
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Document and improve not-found dependency objects
Document the dependency('', required:false) usage. Add dependency() as a shorthand for that. Avoid emitting 'Dependency found: NO' in either case. Fixes mesonbuild#2324
- Loading branch information
1 parent
6ce42e2
commit a6f7344
Showing
5 changed files
with
39 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Not-found dependency objects | ||
|
||
```meson | ||
dep = dependency('', required:false) | ||
``` | ||
|
||
can now be more simply written as | ||
|
||
```meson | ||
dep = dependency() | ||
``` | ||
|
||
which can be used to represent a disabled dependency, and is safe to call | ||
`found()` on, unlike `[]'. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
project('dep-test') | ||
|
||
foo_dep = dependency('', required:false) | ||
if foo_dep.found() | ||
error('not-found dependency was found') | ||
endif | ||
|
||
bar_dep = dependency() | ||
if bar_dep.found() | ||
error('not-found dependency was found') | ||
endif |
2 changes: 2 additions & 0 deletions
2
test cases/failing/64 dependency not-found and required/meson.build
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
project('dep-test') | ||
dep = dependency(required:true) |