| 1 |
project('include dir test', 'c') |
| 2 |
|
| 3 |
inc = include_directories('include') |
| 4 |
subdir('src') |
| 5 |
|
| 6 |
errormsg = '''Tried to form an absolute path to a dir in the source tree. |
| 7 |
You should not do that but use relative paths instead, for |
| 8 |
directories that are part of your project. |
| 9 |
|
| 10 |
To get include path to any directory relative to the current dir do |
| 11 |
|
| 12 |
incdir = include_directories(dirname) |
| 13 |
|
| 14 |
After this incdir will contain both the current source dir as well as the |
| 15 |
corresponding build dir. It can then be used in any subdirectory and |
| 16 |
Meson will take care of all the busywork to make paths work. |
| 17 |
|
| 18 |
Dirname can even be '.' to mark the current directory. Though you should |
| 19 |
remember that the current source and build directories are always |
| 20 |
put in the include directories by default so you only need to do |
| 21 |
include_directories('.') if you intend to use the result in a |
| 22 |
different subdirectory. |
| 23 |
|
| 24 |
Note that this error message can also be triggered by |
| 25 |
external dependencies being installed within your source |
| 26 |
tree - it's not recommended to do this. |
| 27 |
''' |
| 28 |
testcase expect_error(errormsg) |
| 29 |
include_directories(meson.current_source_dir() / 'include') |
| 30 |
endtestcase |
| 31 |
# Test for issue #12217 |
| 32 |
include_directories(meson.current_source_dir() + 'xyz') |