diff options
author | Angelos Mouzakitis <a.mouzakitis@virtualopensystems.com> | 2023-10-10 14:33:42 +0000 |
---|---|---|
committer | Angelos Mouzakitis <a.mouzakitis@virtualopensystems.com> | 2023-10-10 14:33:42 +0000 |
commit | af1a266670d040d2f4083ff309d732d648afba2a (patch) | |
tree | 2fc46203448ddcc6f81546d379abfaeb323575e9 /meson/docs/markdown/Include-directories.md | |
parent | e02cda008591317b1625707ff8e115a4841aa889 (diff) |
Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec
Diffstat (limited to 'meson/docs/markdown/Include-directories.md')
-rw-r--r-- | meson/docs/markdown/Include-directories.md | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/meson/docs/markdown/Include-directories.md b/meson/docs/markdown/Include-directories.md new file mode 100644 index 000000000..6dfed5e48 --- /dev/null +++ b/meson/docs/markdown/Include-directories.md @@ -0,0 +1,30 @@ +--- +short-description: Instructions on handling include directories +... + +# Include directories + +Most `C`/`C++` projects have headers in different directories than +sources. Thus you need to specify include directories. Let's assume +that we are at some subdirectory and wish to add its `include` +subdirectory to some target's search path. To create a include +directory object we do this: + +```meson +incdir = include_directories('include') +``` + +The `incdir` variable now holds a reference to the `include` subdir. +Now we pass that as an argument to a build target: + +```meson +executable('someprog', 'someprog.c', include_directories : incdir) +``` + +Note that these two commands can be given in any subdirectories and it +will still work. Meson will keep track of the locations and generate +proper compiler flags to make it all work. + +Another thing to note is that `include_directories` adds both the +source directory and corresponding build directory to include path, so +you don't have to care. |