mirror of
https://github.com/vlang/v.git
synced 2025-09-15 23:42:28 +03:00
checker: add pkgconfig to comptime if (#10692)
This commit is contained in:
parent
aa5b609d95
commit
eb96ad11d9
7 changed files with 66 additions and 14 deletions
12
doc/docs.md
12
doc/docs.md
|
@ -4017,6 +4017,18 @@ If no flags are passed it will add `--cflags` and `--libs`, both lines below do
|
|||
The `.pc` files are looked up into a hardcoded list of default pkg-config paths, the user can add
|
||||
extra paths by using the `PKG_CONFIG_PATH` environment variable. Multiple modules can be passed.
|
||||
|
||||
To check the existance of a pkg-config use `$pkgconfig('pkg')` as a compile time if condition to
|
||||
check if a pkg-config exists. If it exists the branch will be created. Use `$else` or `$else $if`
|
||||
to handle other cases.
|
||||
|
||||
```v ignore
|
||||
$if $pkgconfig('mysqlclient') {
|
||||
#pkgconfig mysqlclient
|
||||
} $else $if $pkgconfig('mariadb') {
|
||||
#pkgconfig mariadb
|
||||
}
|
||||
```
|
||||
|
||||
### Including C code
|
||||
|
||||
You can also include C code directly in your V module.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue