meson.build 1.0 KB

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