aboutsummaryrefslogtreecommitdiff
path: root/docs/yaml/functions/add_languages.yaml
blob: 6851c4e00d8a8a00c3f9b1d86954dc0bf36755e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: add_languages
returns: bool
description: |
  Add programming languages used by the project.

  This is equivalent to having
  them in the `project` declaration. This function is usually used to
  add languages that are only used under some conditions.

  Returns `true` if all languages specified were found and `false` otherwise.

  If `native` is omitted, the languages may be used for either build or host
  machine, but are never required for the build machine.  (i.e. it is equivalent
  to `add_languages(*langs*, native: false, required: *required*) and
  add_languages(*langs*, native: true, required: false)`. This default behaviour
  may change to `native: false` in a future Meson version.

example: |
  ```meson
  project('foobar', 'c')

  if compiling_for_osx
    add_languages('objc')
  endif
  if add_languages('cpp', required : false)
    executable('cpp-app', 'main.cpp')
  endif

  # More code...
  ```

varargs:
  type: str
  name: Language
  description: The languages to add

kwargs:
  required:
    type: bool
    default: true
    description: |
      If set to `true`, Meson will halt if any of the languages
      specified are not found. *(since 0.47.0)* The value of a
      [`feature`](Build-options.md#features) option can also be passed.
  native:
    type: bool
    since: 0.54.0
    description: |
      If set to `true`, the language will be used to compile for the build
      machine, if `false`, for the host machine.