tests: add test to ensure that build dir is preferred to src dir

Extend the "common/include order" test to ensure that the build
directory is preferred over the source directory. For example,
when using `configure_file()`, the resulting file should be
preferred over a file with the same name in the source directory.
0.tryme
Barnabás Pőcze 2 years ago
parent 9c526974dc
commit ea5a82ee26
  1. 2
      test cases/common/130 include order/inc3/meson.build
  2. 1
      test cases/common/130 include order/inc3/prefer-build-dir-over-src-dir.h
  3. 4
      test cases/common/130 include order/meson.build
  4. 1
      test cases/common/130 include order/ordertest.c

@ -0,0 +1,2 @@
configure_file(output: 'prefer-build-dir-over-src-dir.h',
configuration: configuration_data())

@ -0,0 +1 @@
#error "inc3/prefer-build-dir-over-src-dir.h included"

@ -12,6 +12,8 @@ project('include order', 'c')
# Custom target dir with a built header
subdir('ctsub')
# Configures a header file
subdir('inc3')
# Defines an internal dep
subdir('sub1')
# Defines a per-target include path
@ -32,5 +34,5 @@ test('eh', e)
test('oh', f)
# Test that the order in include_directories() is maintained
incs = include_directories('inc1', 'inc2')
incs = include_directories('inc1', 'inc2', 'inc3')
executable('ordertest', 'ordertest.c', include_directories: incs)

@ -1,4 +1,5 @@
#include "hdr.h"
#include "prefer-build-dir-over-src-dir.h"
#if !defined(SOME_DEFINE) || SOME_DEFINE != 42
#error "Should have picked up hdr.h from inc1/hdr.h"

Loading…
Cancel
Save