3

on meson build, dependencies are resolved by pkg-config/cmake ...

but for system libs, no docs. I only find 2 of them:

  • zlib stands for -lz
  • threads stands for -lpthread

then how can I link -lm -lrt ?

  • "m"
  • "math"
  • "libm"
  • runtime

all guess fail.

fanlix
  • 1,248
  • 1
  • 13
  • 22

2 Answers2

6

ok, method found in doc:

cc = meson.get_compiler('c')
m_dep = cc.find_library('m', required : false)
executable("abc", dependencies : m_dep)

for common libs that's not good design. why not make it easy? such as:

m_dep = dependency('m', method : 'build-in')

fanlix
  • 1,248
  • 1
  • 13
  • 22
0

May be simpler to use the link_args keyword as in:

executable('abc', link_args : '-lm -lrt')
Viktor Ivliiev
  • 1,015
  • 4
  • 14
  • 21