meson.build 1.3 KB

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