C/C++
On this page
This plugin provides the C and C++ programming languages to nitto.
To enable this plugin, put plugin "c_cpp"
at the top of your buildfile.
Using c/c++
To use c/c++ in a target, you need to set the language:
lang "c"
for Clang "cpp"
(orcxx
/c++
) for C++
C/C++ allow for one extra parameter after the language itself: the language standard. This argument can either be a numeric value, a string or a symbol.
Allowed values are
- for C:
- the regex
^(?:gnu|c)?(?:90|89|99|9x|11|1x|17|18|2x)$
- or
iso9899:
following by either of the following:1990 199409 19999 199x 2011 2017 2018
- the regex
- for C++:
- the regex
^(?:(?:gnu|c)\\+\\+)?(?:98|03|11|0x|14|1y|17|1z|20|2a|2b|23)$
- the regex
Library kinds
The allowed library kinds are:
both
: meaning both following kinds at the same timeshared
: shared library (.so
/.dll
)static
: static library (.a
/.lib
)
Commands
inc / includes
Add a include directory to the target. Allows the special build://
and out://
prefixes.
Arguments | |||
---|---|---|---|
# | Name | Type | Info |
0 |
path
|
str
|
Folder to use as a include dir Expanded?: ✅ |
1 |
public
(optional)
|
sym
|
When present, the include dir is also given to dependants. Allowed values:
|
libdir
Adds a library directory to the target. Allows the special build://
and out://
prefixes.
Arguments | |||
---|---|---|---|
# | Name | Type | Info |
0 |
path
|
str
|
Folder to use as a library dir Expanded?: ✅ |
1 |
public
(optional)
|
sym
|
When present, the library dir is also given to dependants. Allowed values:
|
link
Adds a link (dynamic library) to the target.
Arguments | |||
---|---|---|---|
# | Name | Type | Info |
0 |
link
|
str
|
The link to add. Expanded?: ✅ |
1 |
public
(optional)
|
sym
|
When present, the link is also given to dependants. Allowed values:
|
define
Defines a preprocessor symbol for the target.
Arguments | |||
---|---|---|---|
# | Name | Type | Info |
0 |
value
|
str
|
The value; same as using -D on your c/c++ compiler. Expanded?: ✅ |
1 |
public
(optional)
|
sym
|
When present, the define is also given to dependants. Allowed values:
|
flag
Adds a raw compilerflag to the target.
Arguments | |||
---|---|---|---|
# | Name | Type | Info |
0 |
value
|
str
|
The flag that should be given to the compiler. Expanded?: ✅ |
1 |
public
(optional)
|
sym
|
When present, the flag is also given to dependants. Allowed values:
|
Toolchains
The c/c++ plugin gets its information which binaryies to call from the toolchain. Values used:
ar
: archiver, used for static library creationsh
: shared linker, used for shared library creationshflags
: flags for the shared linker
ld
: linker, used when linking a binaryldflags
: flags for the linkerld_rpath_origin
: flags to enable searching for shared libraries in the folder of the binary
windres
: Windows ressource file compiler; transforms.rc
filescxx
: c++ compilercxxflags
: flags for the c++ compiler
cc
: c compilercflags