| 1 |
project('pkg-config static', 'c') |
| 2 |
|
| 3 |
if build_machine.system() != 'windows' |
| 4 |
prefix = meson.source_root() |
| 5 |
else |
| 6 |
# pkg-config files should not use paths with \ |
| 7 |
prefix_parts = meson.source_root().split('\\') |
| 8 |
# If the path is C:/foo/bar, convert it to /c/foo/bar so we can test if our |
| 9 |
# automatic conversion to C:/foo/bar inside PkgConfigDependency is working. |
| 10 |
if prefix_parts[0][1] == ':' |
| 11 |
drive = prefix_parts[0][0] |
| 12 |
else |
| 13 |
drive = prefix_parts[0] |
| 14 |
endif |
| 15 |
new_parts = [] |
| 16 |
foreach part : prefix_parts |
| 17 |
if part != prefix_parts[0] |
| 18 |
new_parts += part |
| 19 |
endif |
| 20 |
endforeach |
| 21 |
prefix = '/@0@/@1@'.format(drive, '/'.join(new_parts)) |
| 22 |
endif |
| 23 |
message(prefix) |
| 24 |
|
| 25 |
# Escape spaces |
| 26 |
prefix_parts = prefix.split(' ') |
| 27 |
prefix = '\ '.join(prefix_parts) |
| 28 |
|
| 29 |
conf = configuration_data() |
| 30 |
conf.set('PREFIX', prefix) |
| 31 |
configure_file(input : 'foo.pc.in', |
| 32 |
output : 'foo.pc', |
| 33 |
configuration : conf) |
| 34 |
|
| 35 |
foo_dep = dependency('foo', static : true) |
| 36 |
|
| 37 |
test('footest', executable('foomain', 'main.c', dependencies : foo_dep)) |