| 1 |
project('include order', 'c') |
| 2 |
|
| 3 |
# Test that the order of priority of include paths (from first to last) is: |
| 4 |
# |
| 5 |
# 1. Target's current build directory |
| 6 |
# 2. Target's current source directory |
| 7 |
# 3. Include paths added with the `c_args:` kwarg |
| 8 |
# 4. Include paths added with the `include_directories`: kwarg |
| 9 |
# Within this, the build dir takes precedence over the source dir |
| 10 |
# 5. Include paths added via `include_directories:` of internal deps |
| 11 |
# Within this, the build dir takes precedence over the source dir |
| 12 |
|
| 13 |
# Custom target dir with a built header |
| 14 |
subdir('ctsub') |
| 15 |
# Configures a header file |
| 16 |
subdir('inc3') |
| 17 |
# Defines an internal dep |
| 18 |
subdir('sub1') |
| 19 |
# Defines a per-target include path |
| 20 |
subdir('sub2') |
| 21 |
# Directory for `c_args:` include path |
| 22 |
subdir('sub3') |
| 23 |
# The directory where the target resides |
| 24 |
subdir('sub4') |
| 25 |
|
| 26 |
# Test that the order in which internal dependencies are specified is |
| 27 |
# preserved. This is needed especially when subprojects get involved and |
| 28 |
# multiple build-root config.h files exist, and we must be sure that the |
| 29 |
# correct one is found: https://github.com/mesonbuild/meson/issues/1495 |
| 30 |
f = executable('somefxe', 'sub4/main.c', |
| 31 |
dependencies : [correctinc, dep, wronginc]) |
| 32 |
|
| 33 |
test('eh', e) |
| 34 |
test('oh', f) |
| 35 |
|
| 36 |
# Test that the order in include_directories() is maintained |
| 37 |
incs = include_directories('inc1', 'inc2', 'inc3') |
| 38 |
executable('ordertest', 'ordertest.c', include_directories: incs) |