summaryrefslogtreecommitdiffstats
path: root/test cases/unit/18 pkgconfig static/meson.build
blob: d1b0fd5ace1da9e4ba5fee3ad4c6f06f4a81d464 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
project('pkg-config static', 'c')

if build_machine.system() != 'windows'
  prefix = meson.source_root()
else
  # pkg-config files should not use paths with \
  prefix_parts = meson.source_root().split('\\')
  # If the path is C:/foo/bar, convert it to /c/foo/bar so we can test if our
  # automatic conversion to C:/foo/bar inside PkgConfigDependency is working.
  if prefix_parts[0][1] == ':'
    drive = prefix_parts[0][0]
  else
    drive = prefix_parts[0]
  endif
  new_parts = []
  foreach part : prefix_parts
    if part != prefix_parts[0]
      new_parts += part
    endif
  endforeach
  prefix = '/@0@/@1@'.format(drive, '/'.join(new_parts))
endif
message(prefix)

# Escape spaces
prefix_parts = prefix.split(' ')
prefix = '\ '.join(prefix_parts)

conf = configuration_data()
conf.set('PREFIX', prefix)
configure_file(input : 'foo.pc.in',
               output : 'foo.pc',
               configuration : conf)

foo_dep = dependency('foo', static : true)

test('footest', executable('foomain', 'main.c', dependencies : foo_dep))